QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#597498#9432. Permutationucup-team1004#AC ✓222ms8276kbC++142.6kb2024-09-28 17:57:112024-09-28 17:57:12

Judging History

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

  • [2024-09-28 17:57:12]
  • 评测
  • 测评结果:AC
  • 用时:222ms
  • 内存:8276kb
  • [2024-09-28 17:57:11]
  • 提交

answer

#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
#define all(x) x.begin(),x.end()
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;
const int N=1e6+5,M=1e7+5,K=1000+5,mod=998244353,Mod=mod-1;const db eps=1e-9;const int INF=1e9+7;mt19937 rnd(263082);
#define Tp template<typename T>
#define Ts template<typename T,typename... Ar>
namespace Debug{
	Tp void _debug(char* f,T t){cerr<<f<<'='<<t<<endl;}
	Ts void _debug(char* f,T x,Ar... y){while(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
	#ifdef LOCAL
	#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
	#else 
	#define gdb(...) void()
	#endif
}using namespace Debug;
int n,A[N],B[N],ans[N],rt;
void init(){
	iota(B+1,B+n+1,1);
	shuffle(B+1,B+n+1,rnd);
	for(int i=1;i<=n;i++) gdb(B[i]);
}
int cts;
int qry(){
	cts++;
	cout<<"0 ";
	for(int i=1;i<=n;i++) cout<<A[i]<<' ';
	cerr<<endl;
	cout.flush();
	int x;cin>>x;
	// int x=0;for(int i=1;i<=n;i++) x+=(A[i]==B[i]);
	return x;
}
void calc(vector<int> id,vector<int> vs){
	gdb(id.size(),vs.size());
	if(id.size()==1){
		ans[id[0]]=vs[0];
		return;
	}
	int len=id.size()/2;
	vector<int> i1(id.begin(),id.begin()+len),i2(id.begin()+len,id.end());
	for(int i=1;i<=n;i++) A[i]=vs[0];
	
	vector<int> v1,v2;
	shuffle(all(vs),rnd);

	vector<int> st;
	
	for(int i=0;i<vs.size();i++){
		if(st.empty()){
			st.push_back(vs[i]);
			continue;
		}
		for(int j:i1) A[j]=st.front();
		for(int j:i2) A[j]=vs[i];
		int w=qry();
		if(w==2){
			for(int i:st) v1.push_back(i);st.clear();
			v2.push_back(vs[i]);
		}else if(w==0){
			v1.push_back(vs[i]);
			for(int i:st) v2.push_back(i);st.clear();
		}else{
			st.push_back(vs[i]);
		}
	}
	gdb(v1.size(),i1.size(),v2.size(),i2.size(),st.size());
	if(v1.size()!=i1.size()){
		for(int i:st) v1.push_back(i);
	}else{
		for(int i:st) v2.push_back(i);
	}
	calc(i1,v1);calc(i2,v2);
}
void Solve(){
	ios::sync_with_stdio(false);cin.tie(0);
	cin>>n;
	init();
	vector<int> id,vs;
	for(int i=1;i<=n;i++) id.push_back(i);
	for(int i=1;i<=n;i++) vs.push_back(i);
	calc(id,vs);
	cout<<"1 ";
	for(int i=1;i<=n;i++) cout<<ans[i]<<' ';cout<<endl;cout.flush();
	// for(int i=1;i<=n;i++) assert(ans[i]==B[i]);
	gdb(cts);
}
int main(){
	int t=1;
	// scanf("%d",&t);
	while(t--) Solve();
	cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 7992kb

input:

5
1
0
2
0
2
2

output:

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

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 215ms
memory: 7984kb

input:

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

output:

0 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 3...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
0

output:

0 1 2 1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
0
2

output:

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

result:

ok Accepted

Test #6:

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

input:

4
2
2
0
0

output:

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

result:

ok Accepted

Test #7:

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

input:

6
1
0
0
1
0
2
0
0

output:

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

result:

ok Accepted

Test #8:

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

input:

7
1
0
1
0
0
0
1
2
2
2

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

score: 0
Accepted
time: 2ms
memory: 8236kb

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

score: 0
Accepted
time: 203ms
memory: 8036kb

input:

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

output:

0 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 103 10...

result:

ok Accepted

Test #18:

score: 0
Accepted
time: 176ms
memory: 8268kb

input:

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

output:

0 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 25...

result:

ok Accepted

Test #19:

score: 0
Accepted
time: 170ms
memory: 8040kb

input:

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

output:

0 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 467 46...

result:

ok Accepted

Test #20:

score: 0
Accepted
time: 212ms
memory: 8140kb

input:

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

output:

0 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 764 76...

result:

ok Accepted

Test #21:

score: 0
Accepted
time: 186ms
memory: 8076kb

input:

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

output:

0 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 85 8...

result:

ok Accepted

Test #22:

score: 0
Accepted
time: 192ms
memory: 8276kb

input:

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

output:

0 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 472 47...

result:

ok Accepted

Test #23:

score: 0
Accepted
time: 186ms
memory: 8044kb

input:

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

output:

0 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 139 13...

result:

ok Accepted

Test #24:

score: 0
Accepted
time: 191ms
memory: 8184kb

input:

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

output:

0 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 1...

result:

ok Accepted

Test #25:

score: 0
Accepted
time: 183ms
memory: 8176kb

input:

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

output:

0 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 577 57...

result:

ok Accepted

Test #26:

score: 0
Accepted
time: 195ms
memory: 8104kb

input:

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

output:

0 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 774 77...

result:

ok Accepted

Test #27:

score: 0
Accepted
time: 209ms
memory: 7988kb

input:

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

output:

0 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 1...

result:

ok Accepted

Test #28:

score: 0
Accepted
time: 190ms
memory: 8140kb

input:

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

output:

0 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 254 25...

result:

ok Accepted

Test #29:

score: 0
Accepted
time: 201ms
memory: 7988kb

input:

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

output:

0 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 477 47...

result:

ok Accepted

Test #30:

score: 0
Accepted
time: 206ms
memory: 8212kb

input:

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

output:

0 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 118 11...

result:

ok Accepted

Test #31:

score: 0
Accepted
time: 203ms
memory: 8044kb

input:

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

output:

0 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 355 35...

result:

ok Accepted

Test #32:

score: 0
Accepted
time: 199ms
memory: 7984kb

input:

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

output:

0 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 1...

result:

ok Accepted

Test #33:

score: 0
Accepted
time: 197ms
memory: 7992kb

input:

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

output:

0 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 4...

result:

ok Accepted

Test #34:

score: 0
Accepted
time: 205ms
memory: 8040kb

input:

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

output:

0 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 382 38...

result:

ok Accepted

Test #35:

score: 0
Accepted
time: 185ms
memory: 8208kb

input:

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

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

score: 0
Accepted
time: 200ms
memory: 8036kb

input:

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

output:

0 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 2...

result:

ok Accepted

Test #37:

score: 0
Accepted
time: 193ms
memory: 8104kb

input:

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

output:

0 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 429 42...

result:

ok Accepted

Test #38:

score: 0
Accepted
time: 222ms
memory: 8176kb

input:

996
0
1
1
1
2
2
1
2
2
0
2
2
1
1
0
1
0
2
1
1
1
2
2
0
0
2
1
1
0
2
2
1
0
2
1
1
2
1
1
1
1
2
1
2
1
1
2
2
1
1
1
0
0
0
2
1
1
1
0
1
0
1
1
0
0
1
1
1
1
0
1
0
0
0
1
0
0
1
0
1
2
1
1
0
1
1
1
1
1
0
2
2
1
1
0
1
2
1
2
2
1
1
1
1
1
1
1
1
2
0
1
0
1
1
1
1
2
0
1
2
0
1
2
1
2
2
1
2
1
1
1
2
1
0
1
1
0
1
1
1
1
1
1
0
0
1
1
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 #39:

score: 0
Accepted
time: 208ms
memory: 8044kb

input:

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

output:

0 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 741 74...

result:

ok Accepted

Test #40:

score: 0
Accepted
time: 215ms
memory: 8072kb

input:

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

output:

0 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 418 41...

result:

ok Accepted

Test #41:

score: 0
Accepted
time: 194ms
memory: 8036kb

input:

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

output:

0 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 595 59...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed