QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#736520#9432. PermutationDaiRuiChen007AC ✓308ms3876kbC++171.2kb2024-11-12 11:36:012024-11-12 11:36:02

Judging History

你现在查看的是最新测评结果

  • [2024-11-12 11:36:02]
  • 评测
  • 测评结果:AC
  • 用时:308ms
  • 内存:3876kb
  • [2024-11-12 11:36:01]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int MAXN=1005;
int n,a[MAXN],p[MAXN];
int qry() {
	cout<<"0 "; for(int i=1;i<=n;++i) cout<<a[i]<<" "; cout<<endl;
	int x; cin>>x; return x;
}
mt19937 rnd(time(0));
void solve(int l,int r,vector<int>&v) {
	if(l==r) return p[l]=v[0],void();
	int mid=(l+r)>>1;
	shuffle(v.begin(),v.end(),rnd);
	vector <int> lv,rv,st;
	for(int x:v) {
		if((int)lv.size()==mid-l+1) { rv.push_back(x); continue; }
		if((int)rv.size()==r-mid) { lv.push_back(x); continue; }
		if(st.empty()) { st.push_back(x); continue; }
		fill(a+1,a+n+1,st[0]);
		fill(a+l,a+mid+1,x);
		int z=qry();
		if(z==0) {
			rv.push_back(x);
			lv.insert(lv.end(),st.begin(),st.end());
			st.clear();
		} else if(z==2) {
			lv.push_back(x);
			rv.insert(rv.end(),st.begin(),st.end());
			st.clear();
		} else st.push_back(x);
	}
	if((int)lv.size()<mid-l+1) lv.insert(lv.end(),st.begin(),st.end());
	else rv.insert(rv.end(),st.begin(),st.end());
	solve(l,mid,lv),solve(mid+1,r,rv);
}
signed main() {
	cin>>n;
	vector <int> v;
	for(int i=1;i<=n;++i) v.push_back(i);
	solve(1,n,v);
	cout<<"1 "; for(int i=1;i<=n;++i) cout<<p[i]<<" "; cout<<endl;
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3624kb

input:

5
0
2
2
2
2

output:

0 5 5 5 3 3 
0 4 4 4 1 1 
0 4 4 2 2 2 
0 3 4 4 4 4 
0 5 5 5 1 5 
1 3 4 2 1 5 

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 291ms
memory: 3676kb

input:

1000
1
1
2
2
0
0
0
1
1
1
1
2
0
2
1
1
1
1
2
2
1
1
1
1
1
0
1
1
2
2
1
1
1
2
0
1
1
1
0
1
1
1
2
1
1
1
1
0
1
0
0
1
2
1
1
0
0
0
1
0
0
0
1
0
1
1
2
1
1
1
1
2
0
0
1
0
1
1
2
0
1
1
2
1
2
2
1
2
0
1
0
1
2
2
0
1
2
2
1
1
1
1
2
1
0
2
1
0
2
0
1
2
0
2
2
0
0
1
1
0
0
2
2
0
1
2
2
1
1
2
2
2
2
1
1
1
1
1
1
1
1
2
1
1
2
1
1
2...

output:

0 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 1...

result:

ok Accepted

Test #3:

score: 0
Accepted
time: 1ms
memory: 3700kb

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

score: 0
Accepted
time: 1ms
memory: 3644kb

input:

2
0

output:

0 1 2 
1 2 1 

result:

ok Accepted

Test #5:

score: 0
Accepted
time: 1ms
memory: 3876kb

input:

3
1
0
0

output:

0 1 1 3 
0 2 2 3 
0 1 3 3 
1 3 1 2 

result:

ok Accepted

Test #6:

score: 0
Accepted
time: 1ms
memory: 3548kb

input:

4
1
2
2
2

output:

0 1 1 2 2 
0 4 4 2 2 
0 3 4 4 4 
0 1 1 2 1 
1 3 4 2 1 

result:

ok Accepted

Test #7:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

6
0
0
0
0
2
0
2

output:

0 1 1 1 2 2 2 
0 6 6 6 4 4 4 
0 5 5 5 3 3 3 
0 2 2 3 3 3 3 
0 3 4 4 4 4 4 
0 6 6 6 5 5 6 
0 6 6 6 1 6 6 
1 3 4 2 1 6 5 

result:

ok Accepted

Test #8:

score: 0
Accepted
time: 1ms
memory: 3772kb

input:

7
1
1
0
2
2
2
2
0
2
0

output:

0 1 1 1 1 3 3 3 
0 7 7 7 7 3 3 3 
0 4 4 4 4 3 3 3 
0 2 2 2 2 6 6 6 
0 3 3 2 2 2 2 2 
0 7 7 1 1 1 1 1 
0 3 7 7 7 7 7 7 
0 2 2 1 2 2 2 2 
0 4 4 4 4 6 6 4 
0 6 6 6 6 5 6 6 
1 3 7 2 1 6 5 4 

result:

ok Accepted

Test #9:

score: 0
Accepted
time: 1ms
memory: 3588kb

input:

8
0
1
2
2
1
2
0
2
2
0
0
2

output:

0 8 8 8 8 2 2 2 2 
0 6 6 6 6 4 4 4 4 
0 3 3 3 3 4 4 4 4 
0 1 1 1 1 5 5 5 5 
0 2 2 1 1 1 1 1 1 
0 3 3 1 1 1 1 1 1 
0 7 3 3 3 3 3 3 3 
0 1 1 2 1 1 1 1 1 
0 8 8 8 8 5 5 8 8 
0 6 6 6 6 4 4 6 6 
0 6 6 6 6 5 6 6 6 
0 8 8 8 8 8 8 4 8 
1 3 7 2 1 6 5 4 8 

result:

ok Accepted

Test #10:

score: 0
Accepted
time: 0ms
memory: 3692kb

input:

9
0
0
2
2
0
2
1
0
2
0
1
0
0
2

output:

0 8 8 8 8 8 3 3 3 3 
0 4 4 4 4 4 9 9 9 9 
0 2 2 2 2 2 6 6 6 6 
0 1 1 1 1 1 5 5 5 5 
0 1 1 1 7 7 7 7 7 7 
0 3 3 3 9 9 9 9 9 9 
0 3 3 7 7 7 7 7 7 7 
0 2 2 7 7 7 7 7 7 7 
0 3 7 7 7 7 7 7 7 7 
0 1 1 1 9 1 1 1 1 1 
0 5 5 5 5 5 4 4 5 5 
0 5 5 5 5 5 8 8 5 5 
0 5 5 5 5 5 4 5 5 5 
0 6 6 6 6 6 6 6 8 6 
1 3 7 ...

result:

ok Accepted

Test #11:

score: 0
Accepted
time: 1ms
memory: 3772kb

input:

10
0
1
2
1
1
0
1
1
0
0
0
0
2
1
0
0
0
0

output:

0 8 8 8 8 8 9 9 9 9 9 
0 6 6 6 6 6 4 4 4 4 4 
0 3 3 3 3 3 4 4 4 4 4 
0 1 1 1 1 1 10 10 10 10 10 
0 7 7 7 7 7 10 10 10 10 10 
0 2 2 2 2 2 10 10 10 10 10 
0 10 10 10 3 3 3 3 3 3 3 
0 7 7 7 3 3 3 3 3 3 3 
0 1 1 1 3 3 3 3 3 3 3 
0 10 10 3 3 3 3 3 3 3 3 
0 7 3 3 3 3 3 3 3 3 3 
0 1 1 1 9 1 1 1 1 1 1 
0 6 ...

result:

ok Accepted

Test #12:

score: 0
Accepted
time: 1ms
memory: 3632kb

input:

11
0
0
1
1
2
2
0
0
2
0
2
2
0
1
0
0
0
2

output:

0 8 8 8 8 8 8 10 10 10 10 10 
0 4 4 4 4 4 4 9 9 9 9 9 
0 2 2 2 2 2 2 6 6 6 6 6 
0 11 11 11 11 11 11 6 6 6 6 6 
0 1 1 1 1 1 1 6 6 6 6 6 
0 10 10 10 9 9 9 9 9 9 9 9 
0 1 1 1 7 7 7 7 7 7 7 7 
0 5 5 5 3 3 3 3 3 3 3 3 
0 3 3 10 10 10 10 10 10 10 10 10 
0 7 3 3 3 3 3 3 3 3 3 3 
0 5 5 5 9 9 5 5 5 5 5 5 
0 ...

result:

ok Accepted

Test #13:

score: 0
Accepted
time: 1ms
memory: 3868kb

input:

12
0
1
2
1
1
0
0
2
2
2
0
2
0
0
0
1
2
0
0
2
0

output:

0 8 8 8 8 8 8 9 9 9 9 9 9 
0 6 6 6 6 6 6 11 11 11 11 11 11 
0 3 3 3 3 3 3 11 11 11 11 11 11 
0 1 1 1 1 1 1 10 10 10 10 10 10 
0 7 7 7 7 7 7 10 10 10 10 10 10 
0 2 2 2 2 2 2 10 10 10 10 10 10 
0 12 12 12 12 12 12 5 5 5 5 5 5 
0 3 3 3 9 9 9 9 9 9 9 9 9 
0 7 7 7 5 5 5 5 5 5 5 5 5 
0 10 10 10 1 1 1 1 1 ...

result:

ok Accepted

Test #14:

score: 0
Accepted
time: 1ms
memory: 3632kb

input:

13
1
1
0
1
1
2
0
1
0
2
2
2
1
2
0
2
0
0
0
1
0
1
0
2
2
0

output:

0 13 13 13 13 13 13 13 10 10 10 10 10 10 
0 9 9 9 9 9 9 9 10 10 10 10 10 10 
0 12 12 12 12 12 12 12 10 10 10 10 10 10 
0 2 2 2 2 2 2 2 6 6 6 6 6 6 
0 11 11 11 11 11 11 11 6 6 6 6 6 6 
0 1 1 1 1 1 1 1 6 6 6 6 6 6 
0 3 3 3 3 3 3 3 7 7 7 7 7 7 
0 4 4 4 4 4 4 4 5 5 5 5 5 5 
0 8 8 8 8 8 8 8 5 5 5 5 5 5 
...

result:

ok Accepted

Test #15:

score: 0
Accepted
time: 1ms
memory: 3688kb

input:

14
0
0
2
1
0
1
2
0
1
2
2
0
2
2
0
1
0
0
2
0
0
0
2
2
0
0
0

output:

0 8 8 8 8 8 8 8 9 9 9 9 9 9 9 
0 6 6 6 6 6 6 6 14 14 14 14 14 14 14 
0 10 10 10 10 10 10 10 3 3 3 3 3 3 3 
0 7 7 7 7 7 7 7 1 1 1 1 1 1 1 
0 2 2 2 2 2 2 2 1 1 1 1 1 1 1 
0 12 12 12 12 12 12 12 5 5 5 5 5 5 5 
0 13 13 13 13 13 13 13 5 5 5 5 5 5 5 
0 11 11 11 11 11 11 11 4 4 4 4 4 4 4 
0 14 14 14 14 9 9...

result:

ok Accepted

Test #16:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

15
1
1
0
1
2
1
0
2
1
2
2
2
0
2
2
2
2
0
1
0
2
2
1
0
1
2
0
0
0
2
0
0

output:

0 13 13 13 13 13 13 13 13 15 15 15 15 15 15 15 
0 9 9 9 9 9 9 9 9 15 15 15 15 15 15 15 
0 12 12 12 12 12 12 12 12 15 15 15 15 15 15 15 
0 2 2 2 2 2 2 2 2 6 6 6 6 6 6 6 
0 11 11 11 11 11 11 11 11 6 6 6 6 6 6 6 
0 7 7 7 7 7 7 7 7 1 1 1 1 1 1 1 
0 3 3 3 3 3 3 3 3 1 1 1 1 1 1 1 
0 4 4 4 4 4 4 4 4 5 5 5 ...

result:

ok Accepted

Test #17:

score: 0
Accepted
time: 253ms
memory: 3716kb

input:

975
0
1
1
1
0
2
1
1
1
0
2
1
0
0
2
2
1
1
1
1
0
0
0
1
2
1
1
2
2
2
1
2
1
1
0
2
2
2
1
0
0
1
0
1
2
1
2
1
0
0
1
2
0
2
1
0
1
1
2
2
0
1
1
1
1
2
1
1
2
0
1
1
2
1
0
1
0
1
0
2
1
2
0
2
0
1
1
1
1
2
1
0
1
1
0
1
1
0
2
0
1
0
1
1
1
2
0
2
2
1
1
1
1
0
1
2
1
2
2
1
1
1
1
2
1
2
1
1
2
1
1
1
1
1
0
1
1
2
0
0
2
1
1
0
2
0
1
1
...

output:

0 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 231 23...

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 277ms
memory: 3712kb

input:

976
2
1
1
0
1
0
0
1
2
1
2
1
0
2
2
1
2
2
2
1
0
0
2
0
2
0
2
2
1
1
1
2
1
1
1
1
0
1
1
1
0
2
1
0
0
0
1
1
1
1
1
1
0
0
1
1
0
1
2
1
0
1
1
1
1
1
1
1
1
1
1
1
0
2
1
2
1
1
1
0
2
2
2
2
1
1
1
2
2
0
0
0
2
0
1
0
1
0
0
2
0
0
1
1
0
0
1
1
1
1
1
2
2
1
0
1
2
1
1
1
0
1
2
0
0
1
1
1
1
1
0
1
0
1
0
1
0
1
1
1
1
0
0
0
0
0
2
0
...

output:

0 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 417 41...

result:

ok Accepted

Test #19:

score: 0
Accepted
time: 263ms
memory: 3620kb

input:

977
0
0
2
0
1
1
0
1
1
0
1
1
0
1
1
1
1
2
0
1
2
1
0
2
2
1
1
1
1
1
2
1
0
1
1
1
1
1
1
0
0
1
0
1
1
0
1
0
1
1
2
1
1
1
0
1
1
1
0
1
1
0
1
1
1
2
1
0
2
0
2
1
0
0
1
1
0
2
2
0
2
1
0
1
2
1
1
2
1
1
2
1
1
1
0
2
0
1
2
1
1
1
1
1
0
2
0
0
0
1
1
1
2
1
1
1
1
2
1
0
1
1
1
1
2
1
2
0
1
2
1
0
2
1
1
2
1
1
0
1
1
0
1
0
1
0
1
0
...

output:

0 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 62...

result:

ok Accepted

Test #20:

score: 0
Accepted
time: 262ms
memory: 3648kb

input:

978
1
2
0
2
0
0
1
0
0
1
0
1
2
1
2
0
0
1
1
2
0
1
1
1
1
1
1
1
2
2
1
1
0
1
0
1
2
2
0
1
1
1
2
0
1
2
1
1
0
1
2
1
1
1
1
1
1
2
0
0
1
0
1
1
2
1
0
1
1
1
1
1
1
1
0
1
2
0
0
2
1
0
0
1
2
2
0
1
0
1
0
0
2
1
2
1
1
1
0
2
1
1
0
2
1
1
1
0
0
1
0
2
2
2
1
0
1
1
2
1
1
2
1
0
1
1
0
2
1
1
1
1
2
1
1
0
2
1
2
0
2
1
0
2
2
1
1
0
...

output:

0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

result:

ok Accepted

Test #21:

score: 0
Accepted
time: 287ms
memory: 3672kb

input:

979
0
2
1
2
2
1
1
1
0
1
2
1
1
2
2
1
0
0
0
0
2
2
1
0
0
0
1
1
1
2
2
1
0
2
0
1
1
2
0
1
1
0
1
1
2
0
1
2
1
2
1
1
1
1
0
1
1
0
1
0
2
2
0
0
0
2
2
1
1
0
1
2
1
1
1
2
0
1
2
2
2
1
1
2
0
1
1
2
1
1
1
1
1
0
1
0
1
1
1
1
0
0
1
2
1
0
1
1
0
2
1
1
2
1
0
0
0
2
1
2
0
1
1
1
1
1
1
1
2
1
2
1
0
1
0
1
0
1
1
0
0
0
2
2
0
1
1
0
...

output:

0 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 62...

result:

ok Accepted

Test #22:

score: 0
Accepted
time: 274ms
memory: 3724kb

input:

980
1
0
1
0
2
0
2
2
2
1
0
1
0
1
2
1
1
0
1
2
1
2
1
2
2
0
1
0
1
1
2
0
1
1
1
0
2
1
1
1
1
1
1
1
1
0
2
1
1
2
0
0
1
1
0
1
1
2
2
0
2
1
1
0
1
0
2
1
1
0
2
2
1
0
1
2
1
1
1
1
2
2
0
1
1
2
1
1
0
2
1
1
0
1
1
0
1
1
2
0
1
2
0
1
2
1
0
1
1
0
1
1
2
0
2
1
1
0
1
1
2
1
1
1
1
0
1
2
0
0
0
1
0
1
1
1
1
2
2
1
0
1
0
1
2
1
1
1
...

output:

0 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 513 51...

result:

ok Accepted

Test #23:

score: 0
Accepted
time: 284ms
memory: 3712kb

input:

981
1
0
1
1
0
1
2
2
1
2
1
1
0
1
2
2
1
2
0
1
2
0
1
0
0
0
1
2
2
1
1
0
2
1
2
2
2
0
1
1
2
0
2
1
2
0
1
2
1
2
0
2
1
1
2
1
0
1
1
2
0
2
1
2
2
2
1
1
2
1
1
0
2
1
1
2
0
1
2
0
0
1
0
0
1
1
1
0
0
2
1
0
1
1
1
2
1
2
1
1
2
2
1
2
1
0
2
0
2
1
1
2
2
1
1
1
1
0
0
2
2
1
1
1
1
1
0
0
0
0
1
2
1
1
0
1
1
0
2
1
1
2
2
2
1
1
1
1
...

output:

0 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 636 63...

result:

ok Accepted

Test #24:

score: 0
Accepted
time: 269ms
memory: 3660kb

input:

982
2
0
0
1
1
0
1
1
0
0
1
1
1
2
1
2
2
2
1
1
1
0
0
1
2
1
0
0
1
1
1
1
2
0
1
1
1
2
1
1
1
1
1
1
1
0
1
0
1
1
1
1
0
2
0
1
0
1
0
0
1
0
2
1
1
1
1
0
1
0
2
1
1
1
0
1
1
1
1
1
1
1
0
2
0
1
0
1
1
2
1
2
0
2
0
1
0
0
1
2
1
2
1
0
2
0
0
1
1
0
0
0
1
1
2
0
1
2
1
2
1
2
0
0
1
1
2
0
1
2
2
2
1
2
0
1
0
1
1
1
1
1
0
1
2
1
2
2
...

output:

0 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 958 95...

result:

ok Accepted

Test #25:

score: 0
Accepted
time: 264ms
memory: 3660kb

input:

983
1
1
1
2
2
2
1
0
1
1
0
2
0
1
1
1
1
0
0
1
1
1
1
1
0
1
2
1
2
1
1
0
1
1
0
0
0
1
1
0
1
1
1
0
0
2
0
1
1
2
1
0
2
2
2
2
2
1
2
2
1
2
0
0
2
1
1
2
0
0
2
1
0
1
2
2
1
1
1
1
1
2
0
2
0
2
1
0
1
1
2
0
1
1
2
2
1
0
0
1
1
1
0
2
1
2
1
1
1
0
1
1
1
0
2
1
0
0
1
1
1
0
0
0
0
1
1
1
1
1
1
0
1
1
1
2
2
1
1
2
2
1
0
1
1
0
1
2
...

output:

0 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 8...

result:

ok Accepted

Test #26:

score: 0
Accepted
time: 288ms
memory: 3724kb

input:

984
0
1
1
2
1
2
2
2
1
1
1
2
1
1
2
1
2
2
1
0
2
1
2
2
0
2
1
2
0
1
1
2
1
1
1
1
1
0
0
2
1
1
1
1
1
1
2
2
2
2
0
1
0
2
1
2
0
2
1
2
0
1
1
1
1
0
2
0
0
1
1
2
2
1
1
1
2
2
2
1
2
2
2
1
0
1
0
1
1
1
0
0
2
1
1
2
1
1
2
1
0
1
1
2
1
1
1
1
0
2
2
0
2
1
2
0
2
0
1
1
2
0
0
1
0
0
0
1
2
1
1
1
1
1
1
1
2
0
1
2
1
2
0
1
1
2
2
2
...

output:

0 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 325 32...

result:

ok Accepted

Test #27:

score: 0
Accepted
time: 248ms
memory: 3668kb

input:

985
1
2
0
1
2
0
1
1
0
2
0
1
1
2
1
1
1
1
2
0
1
1
0
0
1
1
1
2
2
2
1
2
2
0
0
1
0
1
0
1
0
2
2
1
0
1
0
0
1
0
1
0
0
1
1
1
1
0
0
1
1
2
1
0
1
1
1
1
1
1
1
2
1
0
2
2
1
1
0
1
1
1
0
0
1
0
2
1
1
1
1
1
1
1
1
0
2
1
1
2
1
0
2
1
2
2
1
0
2
1
0
1
2
1
1
1
0
1
1
1
1
2
0
1
0
1
1
2
2
1
2
1
0
2
0
1
2
2
0
1
1
2
1
0
1
2
1
0
...

output:

0 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 1...

result:

ok Accepted

Test #28:

score: 0
Accepted
time: 283ms
memory: 3616kb

input:

986
2
2
1
1
2
1
2
2
1
0
0
1
0
1
0
0
2
1
1
2
2
2
0
0
1
0
1
1
1
1
1
1
1
2
1
1
1
0
0
2
0
2
0
0
2
1
0
1
2
1
2
0
1
1
1
0
0
1
2
0
1
1
1
2
1
1
1
0
1
1
2
2
2
2
1
1
1
0
0
1
0
0
0
1
1
1
0
0
0
1
2
2
1
1
1
1
1
1
2
1
1
0
0
0
2
2
2
1
1
0
2
1
1
2
1
1
1
1
1
1
1
2
2
0
0
1
1
0
1
0
1
1
0
2
2
2
0
1
1
0
1
0
1
0
0
1
0
2
...

output:

0 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 416 41...

result:

ok Accepted

Test #29:

score: 0
Accepted
time: 253ms
memory: 3668kb

input:

987
1
1
1
2
1
1
0
2
1
1
1
1
1
1
1
2
1
1
1
2
2
0
1
1
1
2
1
1
0
1
0
0
1
0
0
0
1
2
0
1
1
0
0
1
0
0
2
1
1
1
2
2
1
1
2
0
0
2
0
0
1
1
2
1
1
1
1
1
1
2
1
1
0
1
2
0
1
1
1
1
2
0
1
1
0
2
1
0
0
0
1
2
2
0
1
1
1
0
1
1
1
1
0
1
1
0
0
1
1
1
2
1
2
1
0
1
1
0
1
0
2
0
0
0
1
0
0
1
2
0
1
1
1
2
1
1
2
2
1
2
2
2
1
2
2
1
1
0
...

output:

0 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 369 36...

result:

ok Accepted

Test #30:

score: 0
Accepted
time: 271ms
memory: 3724kb

input:

988
2
1
1
2
1
1
0
0
0
0
2
1
1
1
1
1
1
2
1
0
2
1
1
2
1
0
1
2
2
0
2
1
2
1
1
1
2
0
1
1
1
0
2
1
1
2
2
1
2
1
0
1
1
1
2
1
1
1
1
2
1
1
1
1
2
1
1
1
1
0
1
0
1
1
1
2
0
1
1
2
0
0
2
1
1
1
2
2
1
1
1
1
1
2
1
1
0
1
2
1
2
2
0
1
0
0
1
1
1
2
1
1
1
2
2
0
0
2
2
1
0
1
2
0
1
2
0
2
0
1
1
0
2
0
1
1
2
0
1
0
1
1
2
1
2
2
2
1
...

output:

0 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 667 66...

result:

ok Accepted

Test #31:

score: 0
Accepted
time: 283ms
memory: 3656kb

input:

989
1
0
2
0
1
1
2
1
1
2
2
2
0
1
1
2
1
2
1
1
1
1
1
1
1
2
1
1
1
1
1
1
2
2
1
1
1
1
1
1
1
0
2
2
0
2
1
1
1
2
1
1
2
1
2
2
0
1
1
0
2
1
0
2
1
2
1
1
1
2
1
1
2
0
2
1
0
0
2
2
1
0
1
0
1
2
1
0
2
0
2
0
1
2
2
1
0
1
1
1
0
0
0
1
1
0
1
1
0
1
1
1
1
2
0
2
2
0
2
1
0
1
2
1
2
1
1
1
0
2
1
1
2
1
1
1
1
0
1
2
2
1
1
1
0
1
1
2
...

output:

0 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 840 84...

result:

ok Accepted

Test #32:

score: 0
Accepted
time: 297ms
memory: 3720kb

input:

990
2
1
0
1
2
1
1
1
1
2
1
0
0
2
0
0
0
2
1
2
2
2
2
0
0
1
0
0
2
0
1
1
1
1
2
2
0
1
2
1
2
1
0
2
2
1
1
1
1
0
1
1
1
1
0
2
1
2
1
1
2
1
1
1
1
2
2
2
1
1
0
1
0
1
1
2
2
1
1
0
1
1
0
1
1
2
2
2
0
1
1
0
0
1
1
0
1
0
0
1
1
2
1
2
1
0
1
1
1
1
1
1
0
1
1
0
1
1
0
0
2
2
1
2
1
2
1
0
0
1
1
2
2
0
2
0
2
1
1
0
2
0
2
2
1
0
2
1
...

output:

0 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 6...

result:

ok Accepted

Test #33:

score: 0
Accepted
time: 288ms
memory: 3872kb

input:

991
2
0
2
2
1
2
1
0
1
1
1
1
2
1
2
2
1
2
1
2
0
0
0
1
1
1
0
1
1
1
2
1
0
1
1
1
1
0
0
1
1
1
1
0
1
1
1
2
0
0
0
0
2
2
1
0
0
2
1
0
2
0
1
1
1
2
1
1
1
1
1
1
2
1
1
0
1
0
0
0
2
0
1
0
1
1
1
1
1
0
1
0
2
1
1
0
1
2
0
1
1
2
2
1
0
1
0
0
0
1
1
2
1
0
2
1
2
1
0
1
2
0
2
1
0
2
1
1
1
1
1
1
1
0
0
0
0
1
1
0
1
1
2
1
1
1
1
2
...

output:

0 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 889 88...

result:

ok Accepted

Test #34:

score: 0
Accepted
time: 261ms
memory: 3616kb

input:

992
2
1
2
1
1
1
1
0
2
2
1
0
1
0
2
1
2
1
1
1
2
1
1
0
1
0
0
2
2
1
1
1
1
1
0
1
1
1
2
1
2
1
0
0
2
0
0
0
1
0
1
1
0
1
2
1
1
1
2
0
1
1
2
1
1
1
1
1
0
2
1
1
1
2
0
0
1
2
1
1
2
2
1
0
2
0
2
1
2
1
0
2
1
1
2
0
1
2
1
0
0
1
1
2
2
1
2
1
2
2
2
1
2
0
1
1
1
1
1
2
0
0
2
0
0
2
0
2
0
2
1
1
1
0
1
1
2
2
1
1
1
1
0
0
0
1
1
0
...

output:

0 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 690 69...

result:

ok Accepted

Test #35:

score: 0
Accepted
time: 262ms
memory: 3712kb

input:

993
2
1
0
1
1
1
1
1
2
1
1
2
0
1
0
1
1
0
2
1
1
0
0
0
0
2
2
1
1
1
2
0
0
2
0
1
2
1
1
1
0
1
1
1
2
0
0
2
2
1
2
1
1
2
1
2
1
1
1
1
0
1
2
2
1
2
1
0
1
0
1
2
2
1
0
1
0
1
1
1
2
0
1
2
1
0
1
1
1
1
1
0
2
1
1
2
1
1
1
2
2
1
1
1
1
1
2
0
2
0
0
0
1
2
0
1
1
1
2
1
1
1
1
0
0
2
2
0
1
0
0
2
0
1
0
0
1
0
1
1
1
0
1
2
0
0
0
0
...

output:

0 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 353 35...

result:

ok Accepted

Test #36:

score: 0
Accepted
time: 280ms
memory: 3644kb

input:

994
0
2
1
1
1
0
2
2
1
1
1
1
1
1
0
0
1
2
1
2
2
1
2
1
1
2
0
1
0
1
2
0
2
0
2
0
1
1
0
0
2
1
0
1
1
1
2
2
0
1
0
1
0
1
0
1
1
1
1
1
2
0
2
1
2
2
1
0
0
0
1
0
1
2
2
1
0
1
1
1
2
1
0
1
1
0
1
2
0
2
1
0
1
1
2
1
2
1
2
1
0
2
2
2
0
0
1
2
1
0
1
1
1
1
1
2
1
2
0
2
0
1
1
1
1
1
1
1
1
1
2
1
1
2
1
1
2
1
1
1
0
1
1
1
1
0
0
1
...

output:

0 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 398 39...

result:

ok Accepted

Test #37:

score: 0
Accepted
time: 271ms
memory: 3676kb

input:

995
2
1
2
1
0
1
1
1
1
1
1
1
2
2
2
0
1
2
2
1
1
1
1
1
1
1
2
1
2
1
1
1
0
1
1
1
2
0
1
2
2
0
0
1
1
1
2
0
2
1
1
2
0
2
1
2
1
2
2
0
0
2
0
1
1
1
2
2
0
2
2
1
1
0
0
0
1
0
1
1
0
1
0
0
1
0
0
1
2
1
2
0
1
1
1
1
0
0
1
1
0
0
2
1
1
2
1
1
2
1
1
1
1
0
1
2
1
0
2
0
1
0
2
2
1
1
1
2
2
0
2
2
2
2
2
2
1
1
1
1
2
1
0
1
2
2
1
2
...

output:

0 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 216 21...

result:

ok Accepted

Test #38:

score: 0
Accepted
time: 278ms
memory: 3596kb

input:

996
0
1
1
1
0
2
1
1
1
2
0
1
2
0
2
2
2
2
1
0
1
1
1
1
1
1
1
2
1
1
1
1
1
1
0
0
0
1
1
0
0
1
2
0
0
1
0
0
1
0
2
0
0
2
1
2
1
1
1
2
1
2
1
1
0
1
2
2
0
2
1
2
1
1
2
1
1
1
1
1
1
0
0
0
0
1
2
2
0
1
1
2
2
1
2
2
0
2
0
2
2
1
1
1
1
2
0
0
1
2
1
1
2
0
2
2
1
0
1
0
2
1
2
1
1
2
0
2
1
2
2
2
0
1
1
1
0
1
1
2
1
1
1
0
1
0
1
1
...

output:

0 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 162 16...

result:

ok Accepted

Test #39:

score: 0
Accepted
time: 270ms
memory: 3808kb

input:

997
1
0
1
0
1
1
1
1
1
2
1
1
1
1
1
1
0
1
0
1
0
1
2
1
1
0
2
2
1
0
2
1
0
1
0
2
2
1
1
0
1
1
0
1
0
0
2
2
2
1
2
0
2
0
2
2
0
1
1
1
2
1
1
2
1
1
2
1
1
1
1
0
1
2
1
0
2
0
2
1
1
0
2
1
1
0
1
1
1
1
2
2
1
1
2
2
1
1
1
1
1
0
1
2
1
2
2
1
1
2
2
1
0
1
2
1
1
2
1
1
1
0
1
1
1
2
0
1
0
1
1
0
2
1
0
2
2
1
2
0
0
1
1
2
1
1
2
1
...

output:

0 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 351 35...

result:

ok Accepted

Test #40:

score: 0
Accepted
time: 285ms
memory: 3652kb

input:

998
2
2
2
0
0
1
2
1
1
0
2
1
1
2
2
1
1
2
1
1
1
0
2
2
1
1
0
0
1
0
2
2
2
0
1
1
0
0
1
1
2
1
1
0
2
2
1
0
1
1
1
0
1
1
0
2
2
1
0
1
1
1
1
1
0
0
0
1
1
1
1
1
1
2
1
1
2
2
2
1
1
2
2
2
2
0
1
0
2
1
1
1
1
2
1
2
2
1
2
1
0
0
0
0
0
0
1
1
0
2
0
2
1
1
1
0
0
0
0
2
2
1
0
2
1
0
1
1
1
2
2
0
1
1
2
1
1
0
1
1
2
0
0
1
2
1
1
0
...

output:

0 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 107 10...

result:

ok Accepted

Test #41:

score: 0
Accepted
time: 308ms
memory: 3652kb

input:

999
1
0
1
2
1
1
0
2
2
2
1
0
1
1
2
2
0
1
0
1
0
1
2
1
1
2
1
2
0
1
2
1
1
0
1
1
0
1
1
2
2
1
1
2
1
1
2
1
0
0
2
2
0
0
1
1
1
2
0
0
1
1
1
1
2
2
0
1
1
1
1
0
0
1
1
1
1
2
1
1
2
2
1
2
1
1
1
2
2
1
1
1
0
0
0
2
0
1
0
0
1
1
2
1
1
1
1
2
2
1
1
1
0
1
2
1
1
1
2
0
1
0
1
1
1
2
2
1
1
0
1
1
1
1
2
2
2
1
1
1
0
1
1
1
2
1
1
1
...

output:

0 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 587 58...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed