QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#741805#9432. PermutationfanchuanyuAC ✓252ms3920kbC++141.2kb2024-11-13 15:15:262024-11-13 15:15:27

Judging History

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

  • [2024-11-13 15:15:27]
  • 评测
  • 测评结果:AC
  • 用时:252ms
  • 内存:3920kb
  • [2024-11-13 15:15:26]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int ans[100005];
int n;

int check(int mid, int x, int y) {
	cout<<"0 ";
	for (int i = 1; i <= mid; i++)
		cout << x << ' ';
	for (int i = mid + 1; i <= n; i++)
		cout << y << ' ';
	cout << '\n';
	int a;
	cin >> a;
	return a;
}

void dfs(int l, int r, vector<int>ve) {
	if (l == r) {
		ans[l] = ve[0];
		return ;
	}
	int mid = l + r >> 1;
	random_shuffle(ve.begin(), ve.end());
	vector<int>nums[2];
	int L = 0, pos = 0;
	while (pos + 1 < ve.size()) {
		int num = check(mid, ve[pos], ve[pos + 1]);
		if (num == 0 || num == 2) {
			int tp = (2 - num) / 2;
			for (int i = L; i <= pos; i++)
				nums[tp].push_back(ve[i]);
			nums[tp ^ 1].push_back(ve[pos + 1]);
			L = pos = pos + 2;
		} else {
			pos++;
		}
	}
	if (nums[0].size() != mid - l + 1) {
		for (int i = L; i < ve.size(); i++) {
			nums[0].push_back(ve[i]);
		}
	} else {
		for (int i = L; i < ve.size(); i++) {
			nums[1].push_back(ve[i]);
		}
	}
	dfs(l, mid, nums[0]);
	dfs(mid + 1, r, nums[1]);
}

int main() {
	srand(time(NULL));
	cin >> n;
	vector<int>ve;
	for (int i = 1; i <= n; i++) {
		ve.push_back(i);
	}
	dfs(1, n, ve);
	cout << 1;
	for (int i = 1; i <= n; i++)
		cout << ' ' << ans[i];
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
0
1
2
0
2
2

output:

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

input:

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

output:

0 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 752 75...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1

result:

ok Accepted

Test #4:

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

input:

2
0

output:

0 1 2 
1 2 1

result:

ok Accepted

Test #5:

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

input:

3
1
2
0

output:

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

result:

ok Accepted

Test #6:

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

input:

4
0
0
0
2

output:

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

result:

ok Accepted

Test #7:

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

input:

6
1
0
2
1
2
0
0
0

output:

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

input:

7
2
1
2
0
0
2
0
2
1
2
0

output:

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

input:

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

output:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

0 12 12 12 12 12 12 12 12 14 14 14 14 14 14 14 
0 14 14 14 14 14 14 14 14 8 8 8 8 8 8 8 
0 8 8 8 8 8 8 8 8 3 3 3 3 3 3 3 
0 3 3 3 3 3 3 3 3 6 6 6 6 6 6 6 
0 6 6 6 6 6 6 6 6 9 9 9 9 9 9 9 
0 15 15 15 15 15 15 15 15 2 2 2 2 2 2 2 
0 13 13 13 13 13 13 13 13 4 4 4 4 4 4 4 
0 4 4 4 4 4 4 4 4 11 11 11 11 ...

result:

ok Accepted

Test #17:

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

input:

975
0
1
0
0
0
0
1
2
2
1
1
1
1
0
1
2
1
1
1
0
2
0
2
1
2
2
1
0
2
1
0
2
0
2
1
2
1
2
1
1
1
0
1
1
1
1
2
2
1
2
0
1
2
1
1
0
1
0
2
0
1
1
0
1
0
1
0
1
1
0
1
2
2
1
2
1
0
1
0
0
1
2
1
0
2
1
1
0
1
0
1
2
1
1
1
0
2
0
0
1
1
2
1
1
0
1
0
2
2
2
1
0
0
2
1
0
1
2
0
2
1
1
1
0
0
2
1
1
2
1
0
2
1
2
1
1
2
0
1
1
2
2
1
2
1
0
0
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 #18:

score: 0
Accepted
time: 217ms
memory: 3824kb

input:

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

output:

0 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 512 51...

result:

ok Accepted

Test #19:

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

input:

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

output:

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

result:

ok Accepted

Test #20:

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

input:

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

output:

0 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 52 5...

result:

ok Accepted

Test #21:

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

input:

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

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

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

input:

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

output:

0 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 642 64...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 361 36...

result:

ok Accepted

Test #24:

score: 0
Accepted
time: 216ms
memory: 3824kb

input:

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

output:

0 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 26...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 796 79...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 900 90...

result:

ok Accepted

Test #27:

score: 0
Accepted
time: 231ms
memory: 3664kb

input:

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

output:

0 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 559 55...

result:

ok Accepted

Test #28:

score: 0
Accepted
time: 242ms
memory: 3900kb

input:

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

output:

0 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 790 79...

result:

ok Accepted

Test #29:

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

input:

987
1
1
1
2
1
2
2
0
0
1
0
0
2
1
1
1
1
2
0
1
1
1
2
0
0
1
1
2
0
0
2
0
1
1
1
2
1
1
1
0
2
2
1
1
1
1
1
2
2
0
1
1
1
2
0
1
1
2
0
1
1
1
1
1
2
1
1
0
0
1
1
0
2
0
2
1
2
1
1
0
2
1
0
1
1
1
1
0
2
1
2
1
0
1
0
1
1
1
1
1
1
1
1
1
0
2
1
2
2
0
2
1
0
1
1
1
0
0
1
1
0
1
1
1
1
1
2
1
1
1
0
1
1
1
2
0
2
1
1
0
1
1
1
0
2
1
2
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 #30:

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

input:

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

output:

0 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 150 15...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 273 27...

result:

ok Accepted

Test #32:

score: 0
Accepted
time: 245ms
memory: 3664kb

input:

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

output:

0 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 798 79...

result:

ok Accepted

Test #33:

score: 0
Accepted
time: 226ms
memory: 3900kb

input:

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

output:

0 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 726 72...

result:

ok Accepted

Test #34:

score: 0
Accepted
time: 224ms
memory: 3624kb

input:

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

output:

0 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 81 8...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 514 51...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 864 86...

result:

ok Accepted

Test #37:

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

input:

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

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

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

input:

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

output:

0 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 523 52...

result:

ok Accepted

Test #39:

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

input:

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

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

score: 0
Accepted
time: 227ms
memory: 3664kb

input:

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

output:

0 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 856 85...

result:

ok Accepted

Test #41:

score: 0
Accepted
time: 241ms
memory: 3568kb

input:

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

output:

0 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 374 37...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed