QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#594746#9432. Permutationucup-team896#AC ✓151ms4008kbC++142.7kb2024-09-28 10:03:252024-09-28 10:03:25

Judging History

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

  • [2024-09-28 10:03:25]
  • 评测
  • 测评结果:AC
  • 用时:151ms
  • 内存:4008kb
  • [2024-09-28 10:03:25]
  • 提交

answer

#include<bits/stdc++.h>
#define LL long long
#define LLL __int128
#define uint unsigned
#define ldb long double
#define uLL unsigned long long
using namespace std;
const int N=1e3+5;
int n;
int a[N],bel[N],vs[N];
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
inline void solve(vector<int>id,vector<int>col,bool op){
	if(id.size()==1)return a[id[0]]=(op?1:col[0]),void();
	const int lsz=(id.size()+1)/2,rsz=id.size()-lsz;
	vector<int>lid,rid;
	int lop=0,rop=0;
	for(int j=0;j<lsz;++j)lid.emplace_back(id[j]);
	for(int j=lsz;j<lsz+rsz;++j)rid.emplace_back(id[j]);
	for(auto j:lid)bel[j]=1;
	for(auto j:rid)bel[j]=2;
	vector<int>ls,rs;
	vector<vector<int>>E;
	for(auto i:col)vs[i]=0;
	if(op){
		for(;;){
			int x=col[rng()%col.size()];
			if(vs[x])continue;
			cout<<"0 ";
			for(int i=1;i<=n;++i)
				if(bel[i]==1)cout<<x<<' ';
				else cout<<"1 ";
			cout<<endl;
			int v;cin>>v;
			if(v==0){
				lop=1;
				rs.emplace_back(x);
				for(auto i:col)if(i!=x&&!vs[i])E.emplace_back(vector<int>({i}));
				else if(vs[i])ls.emplace_back(i);
				break;
			}
			if(v==2){
				rop=1;
				ls.emplace_back(x);
				for(auto i:col)if(i!=x&&!vs[i])E.emplace_back(vector<int>({i}));
				else if(vs[i])rs.emplace_back(i);
				break;
			}
			vs[x]=1;
		}
	}
	else for(auto i:col)E.emplace_back(vector<int>({i}));
	for(int k=1;!E.empty();k*=2){
		shuffle(E.begin(),E.end(),rng);
		int p=0;
		vector<vector<int>>nxt;
		for(;p+1<E.size();p+=2){
			int c=E[p][0],d=E[p+1][0];
			if(ls.size()+k+lop>lsz||rs.size()+k+rop>rsz){
				nxt.emplace_back(E[p]);
				for(auto j:E[p+1])nxt.back().emplace_back(j);
				continue;
			}
			cout<<"0 ";
			for(int j=1;j<=n;++j)
				if(bel[j]==1)cout<<c<<' ';
				else if(bel[j]==2)cout<<d<<' ';
				else cout<<"1 ";
			cout<<endl;
			int v;cin>>v;
			if(op)++v;
			if(v==1){
				for(auto j:E[p])rs.emplace_back(j);
				for(auto j:E[p+1])ls.emplace_back(j);
			}
			else if(v==2){
				nxt.emplace_back(E[p]);
				for(auto j:E[p+1])nxt.back().emplace_back(j);
			}
			else{
				for(auto j:E[p])ls.emplace_back(j);
				for(auto j:E[p+1])rs.emplace_back(j);
			}
		}
		if(E.size()&1){
			if((lsz-ls.size()-lop)%(k*2)){
				for(auto j:E[p])ls.emplace_back(j);
			}
			else{
				for(auto j:E[p])rs.emplace_back(j);
			}
		}
		E=nxt;
	}
	for(auto j:lid)bel[j]=0;
	for(auto j:rid)bel[j]=0;
	solve(lid,ls,lop);
	solve(rid,rs,rop);
}
signed main(){
	cin.tie(0)->sync_with_stdio(0);
	cin>>n;
	if(n==1)return cout<<"1 1\n",0;
	vector<int>col,id;
	for(int c=2;c<=n;++c)col.emplace_back(c);
	for(int i=1;i<=n;++i)id.emplace_back(i);
	solve(id,col,1);
	cout<<'1';
	for(int i=1;i<=n;++i)cout<<' '<<a[i];
	return 0;
}
/*
2 8 6 7 5 3 1 4
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
2
1
2
3
0

output:

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

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 138ms
memory: 3780kb

input:

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

output:

0 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 ...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1

result:

ok Accepted

Test #4:

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

input:

2
2

output:

0 2 1 
1 2 1

result:

ok Accepted

Test #5:

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

input:

3
0
2

output:

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

result:

ok Accepted

Test #6:

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

input:

4
1
2
1
2

output:

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

result:

ok Accepted

Test #7:

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

input:

6
2
2
0
2
3
1
0
0

output:

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

input:

7
0
1
0
1
2
1
2
1
3

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

score: 0
Accepted
time: 121ms
memory: 3800kb

input:

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

output:

0 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 735 73...

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 115ms
memory: 3708kb

input:

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

output:

0 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 56 5...

result:

ok Accepted

Test #19:

score: 0
Accepted
time: 110ms
memory: 3728kb

input:

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

output:

0 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 322 32...

result:

ok Accepted

Test #20:

score: 0
Accepted
time: 118ms
memory: 3756kb

input:

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

output:

0 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 719 71...

result:

ok Accepted

Test #21:

score: 0
Accepted
time: 135ms
memory: 3704kb

input:

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

output:

0 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 618 61...

result:

ok Accepted

Test #22:

score: 0
Accepted
time: 117ms
memory: 4004kb

input:

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

output:

0 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 714 71...

result:

ok Accepted

Test #23:

score: 0
Accepted
time: 129ms
memory: 3764kb

input:

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

output:

0 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 34...

result:

ok Accepted

Test #24:

score: 0
Accepted
time: 120ms
memory: 3920kb

input:

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

output:

0 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 167 16...

result:

ok Accepted

Test #25:

score: 0
Accepted
time: 141ms
memory: 3932kb

input:

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

output:

0 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 948 94...

result:

ok Accepted

Test #26:

score: 0
Accepted
time: 115ms
memory: 3764kb

input:

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

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

score: 0
Accepted
time: 137ms
memory: 4008kb

input:

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

output:

0 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 62 6...

result:

ok Accepted

Test #28:

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

input:

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

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

score: 0
Accepted
time: 143ms
memory: 3800kb

input:

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

output:

0 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 863 86...

result:

ok Accepted

Test #30:

score: 0
Accepted
time: 151ms
memory: 3756kb

input:

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

output:

0 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 12...

result:

ok Accepted

Test #31:

score: 0
Accepted
time: 147ms
memory: 3996kb

input:

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

output:

0 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 832 83...

result:

ok Accepted

Test #32:

score: 0
Accepted
time: 107ms
memory: 3760kb

input:

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

output:

0 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 72 7...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 344 34...

result:

ok Accepted

Test #34:

score: 0
Accepted
time: 138ms
memory: 3708kb

input:

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

output:

0 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 705 70...

result:

ok Accepted

Test #35:

score: 0
Accepted
time: 136ms
memory: 4008kb

input:

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

output:

0 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 910 91...

result:

ok Accepted

Test #36:

score: 0
Accepted
time: 138ms
memory: 3768kb

input:

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

output:

0 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 833 83...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 500 50...

result:

ok Accepted

Test #38:

score: 0
Accepted
time: 128ms
memory: 3708kb

input:

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

output:

0 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 312 31...

result:

ok Accepted

Test #39:

score: 0
Accepted
time: 139ms
memory: 3988kb

input:

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

output:

0 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 149 14...

result:

ok Accepted

Test #40:

score: 0
Accepted
time: 123ms
memory: 3944kb

input:

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

output:

0 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 606 60...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 473 47...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed