QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#595202#9432. Permutationucup-team4757#AC ✓292ms3876kbC++142.8kb2024-09-28 12:59:312024-09-28 12:59:38

Judging History

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

  • [2024-09-28 12:59:38]
  • 评测
  • 测评结果:AC
  • 用时:292ms
  • 内存:3876kb
  • [2024-09-28 12:59:31]
  • 提交

answer

# include <bits/stdc++.h>

const int32_t maxn = 1005;

int32_t n, res;

int32_t pos[maxn];

int32_t result = 0, rest = 0;

inline void guess () {
	std::cin >> n;
}

inline int32_t ask (std::vector <int32_t> p) {
	std::cout << 0 << ' ';
	for (auto i : p) std::cout << i << ' ';
	std::cout << std::endl;
	std::cin >> rest;
	return rest - (n - res);
}

std::mt19937 rd (114514);
//std::mt19937 rd (std::random_device {} ());

std::vector <int32_t> wp;

std::vector <int32_t> p, ans;

inline void makesure (const int32_t x, const int32_t y, const int32_t l1, const int32_t r1, const int32_t l2, const int32_t r2) {
	
//	std::cerr << x << ' ' << y << " l1 : " << l1 << " r1 : " << r1 << " l2 : " << l2 << " r2 : " << r2 << '\n'; 
	
	if (l1 == r1 && l2 == r2) {
		int32_t t = 0, t1 = 0, t2 = 0;
		for (int i = 1; i <= n; ++ i) {
			if (pos[i] == 0) ++ t;
			if (t == l1 && ! t1) pos[i] = x, t1 = 1; // std::cerr << "set " << i << ' ' << x << '\n';
			if (t == l2 && ! t2) pos[i] = y, t2 = 1; // std::cerr << "set " << i << ' ' << y << '\n';
		}
	//	std::cerr << "end "  << x << ' ' << y << '\n'; 
		
		return res -= 2, void ();
	}

	p.clear ();
	
	int32_t m1 = (l1 + r1) >> 1, m2 = (l2 + r2) >> 1, t = 0;
	
	for (int i = 1, w = 0; i <= n; ++ i, w = 0) {
		
		if (pos[i]) p.push_back (pos[i]), w = 1;
		else {
				++ t;
			if (l1 <= t && t <= m1) p.push_back (x), w = 1;
			if (m2 <  t && t <= r2) p.push_back (y), w = 1;
			if (w == 0) p.push_back (wp[i - 1]);
		}
	}
	
//	std::cerr << "fst ";
	
//	for (auto i : p) std::cerr << i << ' ';
	
//	std::cerr << '\n';
	
	result = ask (p), p.clear (), t = 0;
	
	if (result == 2) return makesure (x, y, l1, m1, m2 + 1, r2);
	if (result == 0) return makesure (x, y, m1 + 1, r1, l2, m2);
	
	for (int i = 1, w = 0; i <= n; ++ i, w = 0) {
		
		if (pos[i]) p.push_back (pos[i]), w = 1;
		else {	
			++ t;
			if (l1 <= t && t <= m1) p.push_back (x), w = 1;
			if (w == 0) p.push_back (wp[i - 1]);
		}
		
	}
	
//	std::cerr << "sec ";
	
//	for (auto i : p) std::cerr << i << ' ';
	
//	std::cerr << '\n';
	
	result = ask (p);
	
	if (result == 1) return makesure (x, y, l1, m1, l2, m2);
	if (result == 0) return makesure (x, y, m1 + 1, r1, m2 + 1, r2);
}

int main () {
	
	guess (), res = n;
	
	if (n == 1) return std::cout << 1 << ' ' << 1 << std::endl, 0;
	
	for (int i = 1; i <= n; ++ i) wp.push_back (i);
	
	while (ask (wp)) 
		shuffle (wp.begin (), wp.end (), rd);
	
	for (int i = 1; i <= n - (n & 1); i += 2)
		makesure (i, i + 1, 1, res, 1, res);
	
	std::cout << 1 << ' ';
	
	for (int i = 1; i <= n; ++ i) {
		if (pos[i]) std::cout << pos[i] << ' ';
		else std::cout << n << ' ';
	}
	
	std::cout << std::endl;
	
	return 0;
}

/*

6

2 3 1 6 5 4

1
0
1
1
0
1
1
4
4

5
3 1 5 2 4

0
2
1
1
0
4
3
3

*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

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

result:

ok Accepted

Test #2:

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

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #3:

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

input:

1

output:

1 1

result:

ok Accepted

Test #4:

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

input:

2
0
0

output:

0 1 2 
0 1 2 
1 2 1 

result:

ok Accepted

Test #5:

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

input:

3
0
2
0

output:

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

result:

ok Accepted

Test #6:

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

input:

4
0
1
0
0
4

output:

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

result:

ok Accepted

Test #7:

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

input:

6
0
0
2
1
1
3
3
4
4

output:

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

result:

ok Accepted

Test #8:

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

input:

7
0
1
1
1
0
0
4
4
3
3
4
6

output:

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

result:

ok Accepted

Test #9:

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

input:

8
1
0
1
1
1
0
0
4
3
3
4
4
6
8

output:

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

result:

ok Accepted

Test #10:

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

input:

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

output:

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

result:

ok Accepted

Test #11:

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

input:

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

output:

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

result:

ok Accepted

Test #12:

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

input:

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

output:

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

result:

ok Accepted

Test #13:

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

input:

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

output:

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

result:

ok Accepted

Test #14:

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

input:

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

output:

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

result:

ok Accepted

Test #15:

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

input:

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

output:

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

result:

ok Accepted

Test #16:

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

input:

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

output:

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

result:

ok Accepted

Test #17:

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

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #18:

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

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #19:

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

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #20:

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

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #21:

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

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #22:

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

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #23:

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

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #24:

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

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #25:

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

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #26:

score: 0
Accepted
time: 256ms
memory: 3516kb

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #27:

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

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #28:

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

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #29:

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

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #30:

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

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #31:

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

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #32:

score: 0
Accepted
time: 267ms
memory: 3564kb

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #33:

score: 0
Accepted
time: 251ms
memory: 3588kb

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #34:

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

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #35:

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

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #36:

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

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #37:

score: 0
Accepted
time: 273ms
memory: 3628kb

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #38:

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

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #39:

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

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #40:

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

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Test #41:

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

input:

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

output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed