QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#744510#9432. PermutationjiamengtongAC ✓282ms4204kbC++141.8kb2024-11-13 22:12:002024-11-13 22:12:04

Judging History

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

  • [2024-11-13 22:12:04]
  • 评测
  • 测评结果:AC
  • 用时:282ms
  • 内存:4204kb
  • [2024-11-13 22:12:00]
  • 提交

answer

#include<bits/stdc++.h>
#define M 1005
using namespace std;
int n, ans[M], a[M], rans[M], num;
mt19937 rnd(time(0));
void init()
{
	for(int i = 1; i <= n; i++) rans[i] = i;
	shuffle(rans + 1, rans + n + 1, rnd); 
}
int ask1(int l, int r, int x, int y)
{
	num++;
	int mid = (l + r) >> 1, cnt = 0;
	for(int i = 1; i <= mid; i++) if(rans[i] == x) cnt++;
	for(int i = mid + 1; i <= n; i++) if(rans[i] == y) cnt++;
	return cnt;
}
int ask(int l, int r, int x, int y)
{
	int mid = (l + r) >> 1;
	printf("0 ");
	for(int i = 1; i <= mid; i++) printf("%d ", x);
	for(int i = mid + 1; i <= n; i++) printf("%d ", y);
	puts("");
	fflush(stdout);
	int res;
	scanf("%d", &res);
	return res;
}
void solve(int l, int r, vector<int> v)
{
	if(l == r)
	{
		ans[l] = v[0];
		return;
	}
	shuffle(v.begin(), v.end(), rnd);
	vector<int> L[2];
	int prel = 0, x = 0;
	while(x < v.size() - 1)
	{
		int w = ask(l, r, v[x], v[x + 1]);
		if(w == 1) x++;
		else
		{
			w = (2 - w) / 2;
			for(int i = prel; i <= x; i++) L[w].push_back(v[i]);
			L[w ^ 1].push_back(v[x + 1]);
			prel = x = x + 2;
		}
	}
	int mid = (l + r) >> 1;
	if(prel != v.size())
	{
		int ps = (L[0].size() == mid - l + 1);
		for(int i = prel; i < v.size(); i++) L[ps].push_back(v[i]);
	}
	solve(l, mid, L[0]);
	solve(mid + 1, r, L[1]);
}
int main()
{
	scanf("%d", &n);
//	init();
	vector<int> v;
	for(int i = 1; i <= n; i++) v.push_back(i);
	solve(1, n, v);
//	int fl = 1;
//	for(int i = 1; i <= n; i++) fl &= (ans[i] == rans[i]);
//	if(fl) puts("AC");
//	else puts("WA");
//	cout << num << endl;
//	for(int i = 1; i <= n; i++) cout << rans[i] << " ";
//	puts("");
//	for(int i = 1; i <= n; i++) cout << ans[i] << " ";
//	puts("");
	printf("1 ");
	for(int i = 1; i <= n; i++) printf("%d ", ans[i]);
	puts("");
	fflush(stdout);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
0
1
2
0
2
2

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 419 41...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1 

result:

ok Accepted

Test #4:

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

input:

2
2

output:

0 2 1 
1 2 1 

result:

ok Accepted

Test #5:

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

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: 3924kb

input:

4
1
0
2
0

output:

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

result:

ok Accepted

Test #7:

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

input:

6
2
2
2
1
2
2
1
2
0

output:

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

result:

ok Accepted

Test #8:

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

input:

7
1
1
2
2
0
2
2
2
0
0

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

0 3 3 3 3 3 3 8 8 8 8 8 
0 2 2 2 2 2 2 5 5 5 5 5 
0 9 9 9 9 9 9 4 4 4 4 4 
0 11 11 11 11 11 11 1 1 1 1 1 
0 10 10 10 10 10 10 7 7 7 7 7 
0 7 7 7 7 7 7 6 6 6 6 6 
0 10 10 10 9 9 9 9 9 9 9 9 
0 5 5 5 3 3 3 3 3 3 3 3 
0 1 1 1 7 7 7 7 7 7 7 7 
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...

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 675 67...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 182 18...

result:

ok Accepted

Test #19:

score: 0
Accepted
time: 223ms
memory: 3928kb

input:

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

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

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

input:

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

output:

0 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 553 55...

result:

ok Accepted

Test #21:

score: 0
Accepted
time: 229ms
memory: 4128kb

input:

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

output:

0 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 2...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 1...

result:

ok Accepted

Test #23:

score: 0
Accepted
time: 282ms
memory: 4200kb

input:

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

output:

0 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 858 85...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 486 48...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 7...

result:

ok Accepted

Test #26:

score: 0
Accepted
time: 254ms
memory: 3928kb

input:

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

output:

0 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 593 59...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 11...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 112 11...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 881 88...

result:

ok Accepted

Test #31:

score: 0
Accepted
time: 239ms
memory: 4204kb

input:

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

output:

0 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 611 61...

result:

ok Accepted

Test #32:

score: 0
Accepted
time: 244ms
memory: 3844kb

input:

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

output:

0 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 965 96...

result:

ok Accepted

Test #33:

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

input:

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

output:

0 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 681 68...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 313 31...

result:

ok Accepted

Test #35:

score: 0
Accepted
time: 254ms
memory: 3952kb

input:

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

output:

0 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 917 91...

result:

ok Accepted

Test #36:

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

input:

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

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

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

input:

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

output:

0 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 963 96...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 497 49...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 613 61...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 453 45...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 638 63...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed