QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#44185#4565. Rarest Insectszghtyarecrenj100 ✓72ms3896kbC++17899b2022-08-13 14:31:452022-08-13 14:31:45

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-08-13 14:31:45]
  • 评测
  • 测评结果:100
  • 用时:72ms
  • 内存:3896kb
  • [2022-08-13 14:31:45]
  • 提交

answer

#include "insects.h"
#include <bits/stdc++.h>

int a[2005], b[2005], id[2005];

int min_cardinality(int N) {
	int col = 0;
	for (int i = 0; i < N; ++i) {
		move_inside(i);
		if (i && press_button() > 1) move_outside(i);
		else ++col, a[i] = 1;
	}
	std::mt19937 rnd(time(0));
	int L = 1, R = N / col, num = col;
	while (L <= R) {
		int mid = (L + R) >> 1;
		std::iota(id, id + N, 0);
		std::shuffle(id, id + N, rnd);
		for (int i = 0; i < N; ++i)
			if (!a[id[i]] && !b[id[i]]) {
				move_inside(id[i]);
				if (press_button() > mid) move_outside(id[i]);
				else a[id[i]] = 2, ++num;
				if (num >= col * mid) break;
			}
		if (num >= col * mid) {
			L = mid + 1;
			for (int i = 0; i < N; ++i) if (a[i] == 2) a[i] = 1;
		} else {
			R = num / col;
			for (int i = 0; i < N; ++i) if (a[i] == 2) move_outside(i), --num, a[i] = 0; else b[i] = 1;
		}
	}
	return R;
}

詳細信息

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 0ms
memory: 3744kb

input:

6
1
1
2
2
2
2
2
3
2

output:

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

result:

ok 

Test #2:

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

input:

2
2
2
2

output:

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

result:

ok 

Test #3:

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

input:

2
1

output:

8
0 0
8
0 1
8
2
8
3 1

result:

ok 

Test #4:

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

input:

3
1
2
2

output:

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

result:

ok 

Test #5:

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

input:

5
1
2
2
2
2
2
3
2

output:

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

result:

ok 

Test #6:

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

input:

8
1
2
2
2
2
2
1
2
2
2
3
3
3

output:

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

result:

ok 

Test #7:

score: 0
Accepted
time: 5ms
memory: 3744kb

input:

199
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

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

result:

ok 

Test #8:

score: 0
Accepted
time: 13ms
memory: 3820kb

input:

200
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

8
0 0
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
0 28...

result:

ok 

Test #9:

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

input:

200
1
1
2
1
2
1
2
2
2
1
1
1
1
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
1
1
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8
2
8
1 13
8
0 14
8
2
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
0 18
8
2
8
1 18
8
0 19
8
2
8
1 19
8
0 20
8
2
8
1 20
8
...

result:

ok 

Test #11:

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

input:

199
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

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

result:

ok 

Test #12:

score: 0
Accepted
time: 8ms
memory: 3744kb

input:

197
1
1
2
1
2
1
1
1
2
1
2
2
1
2
2
2
2
1
1
2
1
1
1
1
1
2
2
1
2
1
1
2
1
2
1
1
2
2
1
1
2
2
1
2
1
1
1
2
2
2
1
1
2
2
2
1
1
2
2
2
2
2
1
1
2
1
2
2
2
1
1
2
2
1
1
2
1
2
1
1
2
1
2
2
1
1
2
1
2
1
2
2
1
1
1
1
2
1
2
2
1
2
1
1
1
1
1
1
1
2
2
2
2
2
2
1
1
1
2
2
1
2
1
2
1
2
1
1
2
2
2
1
1
1
2
2
2
2
2
1
1
2
2
2
2
1
2
1
...

output:

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

result:

ok 

Test #13:

score: 0
Accepted
time: 3ms
memory: 3772kb

input:

197
1
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

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

result:

ok 

Test #14:

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

input:

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8
0 8
8
2
8
1 8
8
0 9
8
2
8
1 9
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
0 18
8
2
8
1 18
8
0 19
8
2
8...

result:

ok 

Test #16:

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

input:

196
1
1
1
1
2
1
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

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

result:

ok 

Test #17:

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

input:

199
1
1
1
2
1
2
2
2
2
1
2
1
2
2
2
2
1
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2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19
8
2
8
1 19
8
0 20
8
2
8
0 ...

result:

ok 

Test #19:

score: 0
Accepted
time: 8ms
memory: 3768kb

input:

196
1
2
1
1
2
1
1
1
1
1
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

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

result:

ok 

Test #20:

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

input:

196
1
1
2
1
1
1
1
1
2
2
1
2
2
1
1
2
2
2
2
2
1
2
2
2
2
2
2
1
1
1
2
2
2
2
2
1
2
2
2
2
2
1
2
1
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

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

result:

ok 

Test #21:

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

input:

200
1
1
1
2
1
1
2
1
1
1
1
2
2
1
1
1
2
1
1
1
1
2
2
1
2
2
1
1
2
2
1
2
1
1
2
2
1
1
1
2
2
1
1
1
2
1
1
2
1
1
2
2
2
1
1
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
1
2
2
1
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 0
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
1 4
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
1 7
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
1 17
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
1 22
8
0 23
8
2
8
1 23
8
0...

result:

ok 

Test #22:

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

input:

199
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
2
1
1
2
1
2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8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
0 28...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

score: 15
Accepted
time: 22ms
memory: 3824kb

input:

1000
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

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

result:

ok 

Test #25:

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

input:

1000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

8
0 0
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
0 28...

result:

ok 

Test #26:

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

input:

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

output:

8
0 0
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
1 9
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
1 22
8
0 23
8
2
8
1 23
8
0 24
8
2
8
1 2...

result:

ok 

Test #27:

score: 0
Accepted
time: 22ms
memory: 3732kb

input:

999
1
1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1 6
8
0 7
8
2
8
1 7
8
0 8
8
2
8
1 8
8
0 9
8
2
8
1 9
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
0 18...

result:

ok 

Test #29:

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

input:

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

output:

8
0 0
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
1 6
8
0 7
8
2
8
1 7
8
0 8
8
2
8
1 8
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
1 12
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
1 21
8
0 22
8
2
8
1 22
8
0 23
8...

result:

ok 

Test #30:

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

input:

998
1
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2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2
8
1 22
8
0 23
8
2
8
0...

result:

ok 

Test #32:

score: 0
Accepted
time: 22ms
memory: 3828kb

input:

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

output:

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

result:

ok 

Test #33:

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

input:

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

output:

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

result:

ok 

Test #34:

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

input:

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

output:

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

result:

ok 

Test #35:

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

input:

1000
1
1
1
1
2
2
1
2
1
2
2
2
1
1
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2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2
8
1 16
8
0 17
8
2
8
1 17
8
0 18
8
2
8
0 19
8
2
8
1 19
8
0 20
8
2
8
1 20
8
0 21
8
2
8
1 21
8
...

result:

ok 

Test #37:

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

input:

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

output:

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

result:

ok 

Test #38:

score: 0
Accepted
time: 52ms
memory: 3828kb

input:

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

output:

8
0 0
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
1 8
8
0 9
8
2
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
1 14
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
1 21
8
0 22
8
2
8
1 22
8
0 23
8
2
8
0 24
8
...

result:

ok 

Test #39:

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

input:

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

output:

8
0 0
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
1 14
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
1 17
8
0 18
8
2
8
0 19
8
2
8
1 19
8
0 20
8
2
8
0 21
8
2
8
1 21
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
...

result:

ok 

Test #40:

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

input:

996
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
2
1
1
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8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
0 28...

result:

ok 

Test #42:

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

input:

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

output:

8
0 0
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
0 28...

result:

ok 

Subtask #3:

score: 75
Accepted

Test #43:

score: 75
Accepted
time: 3ms
memory: 3832kb

input:

2
2
2
2

output:

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

result:

ok 

Test #44:

score: 75
Accepted
time: 3ms
memory: 3696kb

input:

2
1

output:

8
0 0
8
0 1
8
2
8
3 1

result:

ok 

Test #45:

score: 75
Accepted
time: 2ms
memory: 3816kb

input:

3
1
2
2

output:

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

result:

ok 

Test #46:

score: 75
Accepted
time: 3ms
memory: 3884kb

input:

6
2
1
2
2
2
2
3
3
3
2

output:

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

result:

ok 

Test #47:

score: 75
Accepted
time: 4ms
memory: 3744kb

input:

10
1
2
2
2
2
2
2
2
2
2
3
3
3
4
4
5
6

output:

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

result:

ok 

Test #48:

score: 75
Accepted
time: 15ms
memory: 3752kb

input:

2000
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

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

result:

ok 

Test #49:

score: 75
Accepted
time: 10ms
memory: 3828kb

input:

2000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

8
0 0
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
0 28...

result:

ok 

Test #50:

score: 75
Accepted
time: 42ms
memory: 3700kb

input:

2000
1
1
1
1
1
1
1
2
1
1
1
1
1
2
2
2
1
1
1
1
2
1
1
2
1
1
1
2
1
1
1
2
2
1
1
1
1
2
2
1
1
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
1
2
1
2
2
2
1
2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
2
8
1 20
8
0 21
8
2
8
1 21
8
0 22
8
2
8
1 22
8
0 23
8
2
8
0...

result:

ok 

Test #52:

score: 75
Accepted
time: 13ms
memory: 3896kb

input:

2000
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

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

result:

ok 

Test #53:

score: 75
Accepted
time: 18ms
memory: 3708kb

input:

2000
1
2
1
1
1
2
1
1
2
2
1
2
2
1
1
2
1
2
2
2
1
2
2
1
2
1
1
2
2
2
2
2
1
2
2
1
1
2
1
1
2
2
1
2
1
1
1
2
1
2
1
2
2
1
1
2
2
1
1
2
2
2
2
1
2
1
1
2
1
1
2
1
1
1
1
2
2
1
1
2
1
2
2
2
2
1
2
1
2
1
1
1
2
2
2
2
1
1
2
1
1
1
2
2
2
1
2
2
1
2
2
1
2
1
1
2
1
1
1
1
1
2
2
1
1
1
2
1
2
2
2
1
1
1
1
1
1
2
2
2
2
1
1
2
2
2
1
1...

output:

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

result:

ok 

Test #54:

score: 75
Accepted
time: 57ms
memory: 3708kb

input:

2000
1
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

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

result:

ok 

Test #55:

score: 75
Accepted
time: 27ms
memory: 3708kb

input:

2000
1
1
1
1
1
2
1
1
1
1
1
2
1
2
1
2
1
1
2
1
1
2
2
2
2
2
2
1
2
1
2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8
1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
0 18
8
2
8
1 18
8
0 19
8
2
8
...

result:

ok 

Test #57:

score: 75
Accepted
time: 34ms
memory: 3756kb

input:

1999
1
1
2
1
1
1
2
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

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

result:

ok 

Test #58:

score: 75
Accepted
time: 23ms
memory: 3868kb

input:

1997
1
1
2
1
1
1
2
1
2
2
2
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

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

result:

ok 

Test #59:

score: 75
Accepted
time: 41ms
memory: 3832kb

input:

1998
1
1
1
1
1
1
2
2
1
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

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

result:

ok 

Test #60:

score: 75
Accepted
time: 29ms
memory: 3700kb

input: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 9
8
2
8
1 9
8
0 10
8
2
8
1 10
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
1 20
8
0 21
8
2
8
0 22
8
2
...

result:

ok 

Test #62:

score: 75
Accepted
time: 58ms
memory: 3868kb

input:

1998
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
2
1
1
1
1
1
1
2
2
1
2
1
1
1
2
2
1
2
2
2
1
1
2
2
2
2
2
1
2
2
1
1
2
2
2
1
2
2
1
2
2
2
1
2
2
1
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
1
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
1
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 0
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
1 9
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
1 16
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
1 23
8
0 24
8
2
8
1 24
8
0 25
8
2
8...

result:

ok 

Test #63:

score: 75
Accepted
time: 46ms
memory: 3864kb

input:

2000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
2
2
2
1
1
1
1
2
1
2
1
1
1
1
1
1
1
1
2
2
1
1
2
1
1
1
2
1
1
2
2
1
1
1
1
2
2
1
2
1
1
2
1
1
1
2
2
1
2
1
1
2
2
2
1
2
2
1
1
2
2
1
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
2
8
0 25
8
2
8
0 26
8...

result:

ok 

Test #65:

score: 75
Accepted
time: 40ms
memory: 3820kb

input:

1999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
2
1
1
1
1
2
1
1
1
1
1
2
1
1
1
1
1
2
2
1
2
2
1
1
1
1
1
1
2
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
2
1
1
1
2
1
2
1
1
1
1
1
1
1
2
1
1
1
2
1
1
1
1
2
1
1
1
1
1...

output:

8
0 0
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
0 28...

result:

ok 

Test #66:

score: 75
Accepted
time: 19ms
memory: 3708kb

input:

1998
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
1
1
1
1
1
1
1
1
1
1
1...

output:

8
0 0
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
0 28...

result:

ok 

Test #67:

score: 75
Accepted
time: 7ms
memory: 3824kb

input:

1999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

8
0 0
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
0 28...

result:

ok 

Test #68:

score: 75
Accepted
time: 56ms
memory: 3756kb

input:

1979
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1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2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
0 18...

result:

ok 

Test #70:

score: 75
Accepted
time: 34ms
memory: 3864kb

input:

1979
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

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

result:

ok 

Test #71:

score: 75
Accepted
time: 26ms
memory: 3876kb

input:

1979
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 0
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
0 28...

result:

ok 

Test #72:

score: 75
Accepted
time: 19ms
memory: 3876kb

input:

1981
2
2
2
2
2
2
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 0
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
0 4
8
2
8
1 4
8
0 5
8
2
8
1 5
8
0 6
8
2
8
1 6
8
0 7
8
2
8
1 7
8
0 8
8
2
8
1 8
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
...

result:

ok 

Test #73:

score: 75
Accepted
time: 35ms
memory: 3760kb

input:

1981
1
1
1
1
1
1
1
1
1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
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
0 28...

result:

ok 

Test #75:

score: 75
Accepted
time: 72ms
memory: 3828kb

input:

1989
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 0
8
0 1
8
2
8
1 1
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
...

result:

ok 

Test #76:

score: 75
Accepted
time: 66ms
memory: 3824kb

input:

1970
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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
2
8
0 ...

result:

ok 

Test #78:

score: 75
Accepted
time: 23ms
memory: 3756kb

input:

1980
2
2
2
2
2
2
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 0
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
0 4
8
2
8
1 4
8
0 5
8
2
8
1 5
8
0 6
8
2
8
1 6
8
0 7
8
2
8
1 7
8
0 8
8
2
8
1 8
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
...

result:

ok 

Test #79:

score: 75
Accepted
time: 12ms
memory: 3872kb

input:

1980
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 0
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
0 28...

result:

ok 

Test #80:

score: 75
Accepted
time: 28ms
memory: 3700kb

input:

2000
2
2
2
2
2
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 0
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
0 4
8
2
8
1 4
8
0 5
8
2
8
1 5
8
0 6
8
2
8
1 6
8
0 7
8
2
8
1 7
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8...

result:

ok 

Test #81:

score: 75
Accepted
time: 26ms
memory: 3824kb

input:

2000
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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
8
0 18
8
2
8
1 18
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8...

result:

ok 

Test #83:

score: 75
Accepted
time: 11ms
memory: 3844kb

input:

2000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 0
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
0 28...

result:

ok 

Test #84:

score: 75
Accepted
time: 5ms
memory: 3840kb

input:

540
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

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

result:

ok 

Test #85:

score: 75
Accepted
time: 38ms
memory: 3756kb

input:

1834
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

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

result:

ok 

Test #86:

score: 75
Accepted
time: 25ms
memory: 3844kb

input:

2000
1
2
2
2
2
2
2
2
2
2
2
2
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8
0 8
8
2
8
1 8
8
0 9
8
2
8
1 9
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
0 18...

result:

ok 

Test #88:

score: 75
Accepted
time: 23ms
memory: 3848kb

input:

2000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

8
0 0
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
0 28...

result:

ok 

Test #89:

score: 75
Accepted
time: 21ms
memory: 3872kb

input:

2000
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

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

result:

ok