QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#745274#9432. PermutationIhave4orangesAC ✓280ms4184kbC++141.7kb2024-11-14 08:53:522024-11-14 08:53:52

Judging History

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

  • [2024-11-14 08:53:52]
  • 评测
  • 测评结果:AC
  • 用时:280ms
  • 内存:4184kb
  • [2024-11-14 08:53:52]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
mt19937 rng(time(NULL));
int rint(int l,int r){return l+rng()%(r-l+1);}
int n,a[1005],b[1005];
int ask(){
	printf("0 ");
	for(int i=1;i<=n;++i) printf("%d ",b[i]);
	printf("\n");
	fflush(stdout);
	int res;
	scanf("%d",&res);
	return res;
}
void solve(int l,int r){
	if(l==r) return;
	// cerr<<"solve "<<l<<" "<<r<<endl;
	for(int i=1;i<l;++i) b[i]=a[l];
	for(int i=r+1;i<=n;++i) b[i]=a[l];
	int mid=l+r>>1;
	vector<int> vc;
	for(int i=l;i<=r;++i) vc.push_back(a[i]);
	for(int i=1;i<(int)vc.size();++i) swap(vc[i],vc[rng()%(i+1)]);
	int cur=vc[0];
	vector<int> tmp;
	int li=l-1,ri=mid;
	for(int i=1;i<(int)vc.size();++i){
		if(!cur){
			if(i+1<(int)vc.size()){
				cur=vc[i];
				continue;
			}else{
				if(li<mid) a[++li]=vc[i];
				else a[++ri]=vc[i];
				break;
			}
		}
		for(int j=l;j<=mid;++j) b[j]=cur;
		for(int j=mid+1;j<=r;++j) b[j]=vc[i];
		// cerr<<"? "<<cur<<" "<<vc[i]<<endl;
		int res=ask();
		if(res==2){
			a[++li]=cur;
			for(auto x:tmp) a[++li]=x;
			a[++ri]=vc[i];
			tmp.clear();
			cur=0;
		}else if(res==0){
			a[++ri]=cur;
			for(auto x:tmp) a[++ri]=x;
			a[++li]=vc[i];
			tmp.clear();
			cur=0;
		}else{
			tmp.push_back(cur);
			cur=vc[i];
		}
	}
	if(cur){
		if(li<mid){
			a[++li]=cur;
			for(auto x:tmp) a[++li]=x;
		}else{
			a[++ri]=cur;
			for(auto x:tmp) a[++ri]=x;
		}
	}
	// cerr<<"li="<<li<<" ri="<<ri<<endl;
	// for(int i=l;i<=r;++i) cerr<<a[i]<<" ";
	// cerr<<endl;
	solve(l,mid);
	solve(mid+1,r);
}
signed main(){
	scanf("%d",&n);
	iota(a+1,a+n+1,1);
	solve(1,n);
	printf("1 ");
	for(int i=1;i<=n;++i) printf("%d ",a[i]);
	printf("\n");
	fflush(stdout);
	return 0;
}

详细

Test #1:

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

input:

5
1
1
2
0
2
2

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 64 6...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
2

output:

0 2 1 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
1
2
2

output:

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

result:

ok Accepted

Test #6:

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

input:

4
2
2
2
2

output:

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

result:

ok Accepted

Test #7:

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

input:

6
1
1
0
1
2
0
1
2
0

output:

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

result:

ok Accepted

Test #8:

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

input:

7
0
1
2
2
0
2
0
2
0
0

output:

0 6 6 6 6 1 1 1 
0 7 7 7 7 2 2 2 
0 2 2 2 2 4 4 4 
0 3 3 3 3 5 5 5 
0 1 1 7 7 1 1 1 
0 3 3 2 2 1 1 1 
0 7 3 7 7 7 7 7 
0 1 1 2 1 1 1 1 
0 6 6 6 6 4 4 6 
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: 0ms
memory: 4168kb

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 906 90...

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 234ms
memory: 3888kb

input:

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

output:

0 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 750 75...

result:

ok Accepted

Test #19:

score: 0
Accepted
time: 237ms
memory: 3912kb

input:

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

output:

0 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 389 38...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 652 65...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 179 17...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 785 78...

result:

ok Accepted

Test #23:

score: 0
Accepted
time: 233ms
memory: 3888kb

input:

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

output:

0 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 970 97...

result:

ok Accepted

Test #24:

score: 0
Accepted
time: 249ms
memory: 3892kb

input:

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

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 #25:

score: 0
Accepted
time: 252ms
memory: 3892kb

input:

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

output:

0 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 697 69...

result:

ok Accepted

Test #26:

score: 0
Accepted
time: 259ms
memory: 3908kb

input:

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

output:

0 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 412 41...

result:

ok Accepted

Test #27:

score: 0
Accepted
time: 235ms
memory: 3916kb

input:

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

output:

0 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 241 24...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 345 34...

result:

ok Accepted

Test #29:

score: 0
Accepted
time: 236ms
memory: 3840kb

input:

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

output:

0 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 195 19...

result:

ok Accepted

Test #30:

score: 0
Accepted
time: 243ms
memory: 3888kb

input:

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

output:

0 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 479 47...

result:

ok Accepted

Test #31:

score: 0
Accepted
time: 257ms
memory: 3832kb

input:

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

output:

0 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 5...

result:

ok Accepted

Test #32:

score: 0
Accepted
time: 258ms
memory: 3840kb

input:

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

output:

0 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 393 39...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 394 39...

result:

ok Accepted

Test #34:

score: 0
Accepted
time: 266ms
memory: 3848kb

input:

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

output:

0 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 633 63...

result:

ok Accepted

Test #35:

score: 0
Accepted
time: 275ms
memory: 3892kb

input:

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

output:

0 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 760 76...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 848 84...

result:

ok Accepted

Test #37:

score: 0
Accepted
time: 249ms
memory: 3828kb

input:

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

output:

0 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 451 45...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 141 14...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 424 42...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 464 46...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 148 14...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed