QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#747418#9432. PermutationNelofusAC ✓268ms3876kbC++201.9kb2024-11-14 17:08:112024-11-14 17:08:11

Judging History

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

  • [2024-11-14 17:08:11]
  • 评测
  • 测评结果:AC
  • 用时:268ms
  • 内存:3876kb
  • [2024-11-14 17:08:11]
  • 提交

answer

/* Code by Heratino & Nelofus */
// No I still can't seem to
// Sing more than blues when it's time for my verse
// It's true that I need you
// To turn my blues into bursting fireworks
#include <bits/stdc++.h>
using i64 = long long;

std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
int n;

int query(std::vector<int> p) {
	std::cout << 0;
	for (int &x : p)	std::cout << ' ' << x + 1;
	std::cout << std::endl;
	int v;
	std::cin >> v;
	return v;
}

std::vector<int> p;
void solve(int l, int r, std::vector<int> a) {
	if (r - l == 1) {
		assert(a.size() != 0);
		p[l] = a[0];
		return ;
	}
	int m = (l + r) / 2;
	std::shuffle(a.begin(), a.end(), rng);
	std::vector<int> v;
	std::vector<int> al, ar;
	for (auto x : a) {
		if (v.empty()) {
			v.push_back(x);
		} else {
			std::vector b(n, x);
			for (int i = l; i < m; i++) {
				b[i] = v[0];
			}
			int res = query(b);
			if (res == 0) {
				for (auto y : v) {
					ar.push_back(y);
				}
				al.push_back(x);
				v.clear();
			} else if (res == 1) {
				v.push_back(x);
			} else {
				for (auto y : v) {
					al.push_back(y);
				}
				ar.push_back(x);
				v.clear();
			}
		}
	}
	if (!v.empty()) {
		if (al.empty()) {
			al = v;
		} else if (ar.empty()) {
			ar = v;
		} else {
			std::vector b(n, al[0]);
			for (int i = m; i < r; i++) {
				b[i] = v[0];
			}
			if (query(b) == 2) {
				std::copy(v.begin(), v.end(), std::back_inserter(ar));
			} else {
				std::copy(v.begin(), v.end(), std::back_inserter(al));
			}
		}
	}
	solve(l, m, al);
	solve(m, r, ar);
}

int main() {
	std::cin >> n;
	p.resize(n);
	std::vector<int> a(n);
	for (int i = 0; i < n; i++)	a[i] = i;
	std::shuffle(a.begin(), a.end(), rng);
	solve(0, n, a);
	std::cout << 1;
	for (int i = 0; i < n; i++)
		std::cout << ' ' << p[i] + 1;
	std::cout << std::endl;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
1
2
1
2
2
1
0
2

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 996 99...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1

result:

ok Accepted

Test #4:

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

input:

2
2

output:

0 2 1
1 2 1

result:

ok Accepted

Test #5:

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

input:

3
1
0
0

output:

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

result:

ok Accepted

Test #6:

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

input:

4
0
0
2
2

output:

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

result:

ok Accepted

Test #7:

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

input:

6
2
2
0
1
0
0
1
0
0

output:

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

result:

ok Accepted

Test #8:

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

input:

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

output:

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

result:

ok Accepted

Test #9:

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

input:

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

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 551 55...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 757 75...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 307 30...

result:

ok Accepted

Test #20:

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

input:

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

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

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

input:

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

output:

0 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 628 62...

result:

ok Accepted

Test #22:

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

input:

980
0
0
2
2
1
1
0
0
2
2
2
1
1
2
1
1
1
0
2
1
2
2
0
2
1
2
1
1
2
1
0
0
0
0
1
1
1
1
2
1
1
2
1
2
1
0
1
1
2
1
1
0
0
0
0
1
2
1
0
0
1
2
1
1
1
2
1
1
1
2
2
1
1
2
0
1
1
1
2
1
1
0
2
1
1
1
2
1
2
1
1
2
2
1
2
0
0
0
2
0
0
1
2
1
1
0
1
1
2
1
1
1
1
0
2
2
1
1
1
1
1
1
2
1
0
0
1
2
1
1
1
1
0
0
2
2
2
0
2
1
1
1
1
2
2
0
0
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 #23:

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

input:

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

output:

0 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 166 16...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 349 34...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 627 62...

result:

ok Accepted

Test #26:

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

input:

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

output:

0 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 57 5...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 961 96...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 74...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 492 49...

result:

ok Accepted

Test #30:

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

input:

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

output:

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

result:

ok Accepted

Test #31:

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

input:

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

output:

0 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 780 78...

result:

ok Accepted

Test #32:

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

input:

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

output:

0 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 753 75...

result:

ok Accepted

Test #33:

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

input:

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

output:

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

result:

ok Accepted

Test #34:

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

input:

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

output:

0 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 526 52...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 841 84...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 27 2...

result:

ok Accepted

Test #37:

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

input:

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

output:

0 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 9...

result:

ok Accepted

Test #38:

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

input:

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

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

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

input:

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

output:

0 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 93 9...

result:

ok Accepted

Test #40:

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

input:

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

output:

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

result:

ok Accepted

Test #41:

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

input:

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

output:

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

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed