QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#430025#4565. Rarest Insectsjames1BadCreeper#47.5 41ms4200kbC++171.5kb2024-06-03 11:36:492024-06-03 11:36:50

Judging History

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

  • [2024-06-03 11:36:50]
  • 评测
  • 测评结果:47.5
  • 用时:41ms
  • 内存:4200kb
  • [2024-06-03 11:36:49]
  • 提交

answer

#include "insects.h"
#include <bits/stdc++.h>
using namespace std; 
const int N = 2e3 + 5; 

// 最多问 3n 次询问
int n, m, k, id[N]; 
bool in[N]; 
mt19937 Rand(time(0)); 

void Move_inside(int x) { move_inside(id[x] - 1); }
void Move_outside(int x) { move_outside(id[x] - 1); }
bool check(int x) { // 最罕见的昆虫是否能 >= x
    int cnt = n; 
    for (int i = 1; i <= n; ++i) {
        Move_inside(i); in[i] = 1; 
        if (press_button() > x) {
            Move_outside(i), in[i] = 0, --cnt; 
            if (cnt < k * x) {
                for (int i = 1; i <= n; ++i)
                    if (in[i]) Move_outside(i), in[i] = 0; 
                return 0; 
            }
        }
    }
    for (int i = 1; i <= n; ++i)
        if (in[i]) Move_outside(i); 
    return cnt == k * x; 
}
int min_cardinality(int N) {
    n = N; 
    k = n; 
    for (int i = 1; i <= n; ++i) id[i] = i; 
    shuffle(id + 1, id + n + 1, Rand);  
    for (int i = 1; i <= n; ++i) {
        Move_inside(i), in[i] = 1; 
        if (press_button() > 1) Move_outside(i), in[i] = 0, --k; 
    }
    for (int i = 1; i <= n; ++i)
        if (in[i]) Move_outside(i); 
    int L = 0, R = n / k + 1; 
    while (L + 1 != R) {
        int mid = L + R >> 1; 
        if (check(mid)) L = mid; 
        else R = mid; 
    }
    return L; 
}

// 我们可以知道的信息:

// n 次代价知道昆虫种类数 k
// n 次代价知道最常见的昆虫基数

// 那么最罕见的昆虫的基数至多是 n / k
// 直接扫,

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 1ms
memory: 3900kb

input:

6
1
2
2
1
1
2
1
2
2
1
1
2
1
2
3

output:

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

result:

ok 

Test #2:

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

input:

2
1
2
1
2
1
2

output:

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

result:

ok 

Test #3:

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

input:

2
1
1
1
1

output:

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

result:

ok 

Test #4:

score: 10
Accepted
time: 1ms
memory: 3960kb

input:

3
1
1
2
1
1
2

output:

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

result:

ok 

Test #5:

score: 10
Accepted
time: 1ms
memory: 3900kb

input:

5
1
2
1
2
2
1
2
1
2
2
1
2
2
2
3

output:

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

result:

ok 

Test #6:

score: 10
Accepted
time: 1ms
memory: 3972kb

input:

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

output:

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

result:

ok 

Test #7:

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

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 156
8
2
8
0 29
8
2
8
1 29
8
0 17
8
2
8
1 17
8
0 34
8
2
8
1 34
8
0 89
8
2
8
1 89
8
0 28
8
2
8
1 28
8
0 25
8
2
8
1 25
8
0 12
8
2
8
1 12
8
0 1
8
2
8
1 1
8
0 98
8
2
8
1 98
8
0 35
8
2
8
1 35
8
0 171
8
2
8
1 171
8
0 114
8
2
8
1 114
8
0 133
8
2
8
1 133
8
0 198
8
2
8
1 198
8
0 189
8
2
8
1 189
8
0 125
8
...

result:

ok 

Test #8:

score: 10
Accepted
time: 3ms
memory: 3896kb

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 144
8
2
8
0 28
8
2
8
0 85
8
2
8
0 99
8
2
8
0 88
8
2
8
0 20
8
2
8
0 65
8
2
8
0 179
8
2
8
0 8
8
2
8
0 29
8
2
8
0 34
8
2
8
0 170
8
2
8
0 72
8
2
8
0 132
8
2
8
0 68
8
2
8
0 188
8
2
8
0 124
8
2
8
0 55
8
2
8
0 131
8
2
8
0 16
8
2
8
0 35
8
2
8
0 53
8
2
8
0 160
8
2
8
0 177
8
2
8
0 112
8
2
8
0 156
8
2
8
0 ...

result:

ok 

Test #9:

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

input:

200
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
1
2
2
2
1
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
...

output:

8
0 144
8
2
8
0 28
8
2
8
0 85
8
2
8
0 99
8
2
8
0 88
8
2
8
0 20
8
2
8
0 65
8
2
8
0 179
8
2
8
0 8
8
2
8
0 29
8
2
8
1 29
8
0 34
8
2
8
1 34
8
0 170
8
2
8
1 170
8
0 72
8
2
8
1 72
8
0 132
8
2
8
1 132
8
0 68
8
2
8
1 68
8
0 188
8
2
8
1 188
8
0 124
8
2
8
1 124
8
0 55
8
2
8
0 131
8
2
8
1 131
8
0 16
8
2
8
1 16...

result:

ok 

Test #10:

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

input:

198
1
1
1
1
1
1
1
2
1
1
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
1
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
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
...

output:

8
0 144
8
2
8
0 28
8
2
8
0 85
8
2
8
0 99
8
2
8
0 88
8
2
8
0 20
8
2
8
0 65
8
2
8
0 179
8
2
8
1 179
8
0 8
8
2
8
0 29
8
2
8
0 34
8
2
8
0 170
8
2
8
1 170
8
0 72
8
2
8
1 72
8
0 132
8
2
8
1 132
8
0 68
8
2
8
1 68
8
0 188
8
2
8
1 188
8
0 124
8
2
8
1 124
8
0 55
8
2
8
1 55
8
0 131
8
2
8
1 131
8
0 16
8
2
8
0 3...

result:

ok 

Test #11:

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

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
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
...

output:

8
0 156
8
2
8
0 29
8
2
8
1 29
8
0 17
8
2
8
1 17
8
0 34
8
2
8
1 34
8
0 89
8
2
8
1 89
8
0 28
8
2
8
1 28
8
0 25
8
2
8
1 25
8
0 12
8
2
8
1 12
8
0 1
8
2
8
1 1
8
0 98
8
2
8
1 98
8
0 35
8
2
8
1 35
8
0 171
8
2
8
1 171
8
0 114
8
2
8
1 114
8
0 133
8
2
8
1 133
8
0 198
8
2
8
1 198
8
0 189
8
2
8
1 189
8
0 125
8
...

result:

ok 

Test #12:

score: 10
Accepted
time: 3ms
memory: 4152kb

input:

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

output:

8
0 156
8
2
8
0 29
8
2
8
0 17
8
2
8
1 17
8
0 34
8
2
8
1 34
8
0 89
8
2
8
1 89
8
0 28
8
2
8
0 25
8
2
8
0 12
8
2
8
1 12
8
0 1
8
2
8
0 98
8
2
8
0 35
8
2
8
0 171
8
2
8
0 114
8
2
8
1 114
8
0 133
8
2
8
0 69
8
2
8
1 69
8
0 189
8
2
8
0 125
8
2
8
0 110
8
2
8
1 110
8
0 60
8
2
8
1 60
8
0 20
8
2
8
1 20
8
0 80
8
...

result:

ok 

Test #13:

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

input:

197
1
1
1
2
2
2
2
2
2
2
1
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
2
2
...

output:

8
0 156
8
2
8
0 29
8
2
8
0 17
8
2
8
0 34
8
2
8
1 34
8
0 89
8
2
8
1 89
8
0 28
8
2
8
1 28
8
0 25
8
2
8
1 25
8
0 12
8
2
8
1 12
8
0 1
8
2
8
1 1
8
0 98
8
2
8
1 98
8
0 35
8
2
8
0 171
8
2
8
1 171
8
0 114
8
2
8
1 114
8
0 133
8
2
8
1 133
8
0 69
8
2
8
1 69
8
0 189
8
2
8
1 189
8
0 125
8
2
8
0 110
8
2
8
1 110
8...

result:

ok 

Test #14:

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

input:

198
1
1
1
1
1
2
1
1
2
1
1
1
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
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
...

output:

8
0 144
8
2
8
0 28
8
2
8
0 85
8
2
8
0 99
8
2
8
0 88
8
2
8
0 20
8
2
8
1 20
8
0 65
8
2
8
0 179
8
2
8
0 8
8
2
8
1 8
8
0 29
8
2
8
0 34
8
2
8
0 170
8
2
8
0 72
8
2
8
0 132
8
2
8
0 68
8
2
8
1 68
8
0 188
8
2
8
1 188
8
0 124
8
2
8
1 124
8
0 55
8
2
8
1 55
8
0 131
8
2
8
1 131
8
0 16
8
2
8
1 16
8
0 35
8
2
8
1 3...

result:

ok 

Test #15:

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

input:

200
1
1
1
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 144
8
2
8
0 28
8
2
8
0 85
8
2
8
0 99
8
2
8
1 99
8
0 88
8
2
8
1 88
8
0 20
8
2
8
0 65
8
2
8
0 179
8
2
8
1 179
8
0 8
8
2
8
1 8
8
0 29
8
2
8
1 29
8
0 34
8
2
8
1 34
8
0 170
8
2
8
1 170
8
0 72
8
2
8
1 72
8
0 132
8
2
8
1 132
8
0 68
8
2
8
1 68
8
0 188
8
2
8
1 188
8
0 124
8
2
8
1 124
8
0 55
8
2
8
1 55
8
...

result:

ok 

Test #16:

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

input:

196
1
1
2
2
1
2
1
1
2
2
2
2
2
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 114
8
2
8
0 53
8
2
8
0 127
8
2
8
1 127
8
0 123
8
2
8
1 123
8
0 56
8
2
8
0 17
8
2
8
1 17
8
0 178
8
2
8
0 142
8
2
8
0 34
8
2
8
1 34
8
0 79
8
2
8
1 79
8
0 161
8
2
8
1 161
8
0 25
8
2
8
1 25
8
0 62
8
2
8
1 62
8
0 172
8
2
8
1 172
8
0 146
8
2
8
1 146
8
0 45
8
2
8
1 45
8
0 43
8
2
8
1 43
8
0 13
8
2
8
0 1...

result:

ok 

Test #17:

score: 10
Accepted
time: 6ms
memory: 3892kb

input:

199
1
1
1
1
1
2
2
1
2
2
2
2
2
1
2
1
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
...

output:

8
0 115
8
2
8
0 17
8
2
8
0 45
8
2
8
0 5
8
2
8
0 57
8
2
8
0 14
8
2
8
1 14
8
0 179
8
2
8
1 179
8
0 143
8
2
8
0 35
8
2
8
1 35
8
0 38
8
2
8
1 38
8
0 8
8
2
8
1 8
8
0 130
8
2
8
1 130
8
0 63
8
2
8
1 63
8
0 188
8
2
8
0 147
8
2
8
1 147
8
0 110
8
2
8
0 26
8
2
8
1 26
8
0 33
8
2
8
1 33
8
0 183
8
2
8
1 183
8
0 2...

result:

ok 

Test #18:

score: 10
Accepted
time: 6ms
memory: 3888kb

input:

196
1
1
1
1
1
1
1
2
2
1
2
2
1
2
2
2
1
2
2
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 114
8
2
8
0 53
8
2
8
0 127
8
2
8
0 123
8
2
8
0 56
8
2
8
0 17
8
2
8
0 178
8
2
8
0 142
8
2
8
1 142
8
0 34
8
2
8
1 34
8
0 79
8
2
8
0 161
8
2
8
1 161
8
0 25
8
2
8
1 25
8
0 62
8
2
8
0 172
8
2
8
1 172
8
0 146
8
2
8
1 146
8
0 45
8
2
8
1 45
8
0 43
8
2
8
0 13
8
2
8
1 13
8
0 182
8
2
8
1 182
8
0 135
8
2
8
...

result:

ok 

Test #19:

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

input:

196
1
1
2
1
1
2
1
2
2
1
1
2
1
2
1
2
1
1
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
2
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 114
8
2
8
0 53
8
2
8
0 127
8
2
8
1 127
8
0 123
8
2
8
0 56
8
2
8
0 17
8
2
8
1 17
8
0 178
8
2
8
0 142
8
2
8
1 142
8
0 34
8
2
8
1 34
8
0 79
8
2
8
0 161
8
2
8
0 25
8
2
8
1 25
8
0 62
8
2
8
0 172
8
2
8
1 172
8
0 146
8
2
8
0 45
8
2
8
1 45
8
0 43
8
2
8
0 13
8
2
8
0 182
8
2
8
0 135
8
2
8
0 108
8
2
8
1 10...

result:

ok 

Test #20:

score: 10
Accepted
time: 5ms
memory: 3976kb

input:

196
1
1
1
1
1
1
2
1
2
2
1
1
2
1
2
2
2
2
2
1
1
2
2
1
1
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
1
2
1
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
...

output:

8
0 114
8
2
8
0 53
8
2
8
0 127
8
2
8
0 123
8
2
8
0 56
8
2
8
0 17
8
2
8
0 178
8
2
8
1 178
8
0 142
8
2
8
0 34
8
2
8
1 34
8
0 79
8
2
8
1 79
8
0 161
8
2
8
0 25
8
2
8
0 62
8
2
8
1 62
8
0 172
8
2
8
0 146
8
2
8
1 146
8
0 45
8
2
8
1 45
8
0 43
8
2
8
1 43
8
0 13
8
2
8
1 13
8
0 182
8
2
8
1 182
8
0 135
8
2
8
0 ...

result:

ok 

Test #21:

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

input:

200
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
2
1
1
2
1
1
1
2
2
1
1
1
2
2
2
2
1
2
2
1
2
1
1
1
2
1
1
1
1
2
2
2
1
2
1
2
2
2
1
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
1
2
1
2
1
2
1
1
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
1
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
...

output:

8
0 114
8
2
8
0 53
8
2
8
0 127
8
2
8
0 123
8
2
8
0 56
8
2
8
0 17
8
2
8
0 178
8
2
8
0 142
8
2
8
0 34
8
2
8
0 79
8
2
8
0 161
8
2
8
1 161
8
0 25
8
2
8
0 62
8
2
8
0 172
8
2
8
0 146
8
2
8
0 45
8
2
8
1 45
8
0 43
8
2
8
0 13
8
2
8
0 182
8
2
8
1 182
8
0 135
8
2
8
0 108
8
2
8
0 179
8
2
8
0 154
8
2
8
1 154
8
0...

result:

ok 

Test #22:

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

input:

199
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
2
2
1
2
1
1
1
1
1
1
1
1
1
1
1
2
1
2
1
2
1
1
1
2
2
1
2
1
2
2
1
2
1
2
2
1
1
2
2
2
2
2
2
1
2
2
2
1
2
1
1
1
2
2
2
2
2
1
2
1
2
2
1
2
1
1
2
2
1
1
2
1
2
2
2
1
1
1
2
1
2
2
2
2
1
2
1
2
1
1
1
1
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
1
2
...

output:

8
0 115
8
2
8
0 17
8
2
8
0 45
8
2
8
0 5
8
2
8
0 57
8
2
8
0 14
8
2
8
0 179
8
2
8
0 143
8
2
8
0 35
8
2
8
0 38
8
2
8
0 8
8
2
8
0 130
8
2
8
0 63
8
2
8
0 188
8
2
8
0 147
8
2
8
0 110
8
2
8
0 26
8
2
8
0 33
8
2
8
0 183
8
2
8
0 2
8
2
8
0 83
8
2
8
1 83
8
0 109
8
2
8
0 155
8
2
8
0 36
8
2
8
0 108
8
2
8
0 10
8
2...

result:

ok 

Test #23:

score: 10
Accepted
time: 2ms
memory: 3892kb

input:

198
1
1
1
1
1
1
1
1
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
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
2
1
2
2
1
2
1
1
1
1
2
2
1
1
2
2
1
1
1
1
1
2
1
1
2
2
1
1
2
2
1
2
2
2
1
2
1
1
1
1
2
2
2
2
2
1
1
2
2
1
1
2
1
1
2
1
1
1
2
2
1
2
1
2
1
2
2
1
2
1
1
2
2
2
1
1
1
2
2
2
2
2
1
2
1
2
...

output:

8
0 114
8
2
8
0 53
8
2
8
0 127
8
2
8
0 123
8
2
8
0 56
8
2
8
0 17
8
2
8
0 178
8
2
8
0 142
8
2
8
0 34
8
2
8
0 79
8
2
8
0 161
8
2
8
0 25
8
2
8
0 62
8
2
8
0 172
8
2
8
0 146
8
2
8
0 45
8
2
8
0 43
8
2
8
0 13
8
2
8
0 182
8
2
8
0 135
8
2
8
0 108
8
2
8
0 179
8
2
8
0 154
8
2
8
0 74
8
2
8
0 165
8
2
8
0 183
8
2...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

score: 15
Accepted
time: 20ms
memory: 4200kb

input:

1000
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 822
8
2
8
0 258
8
2
8
1 258
8
0 529
8
2
8
1 529
8
0 244
8
2
8
1 244
8
0 747
8
2
8
1 747
8
0 455
8
2
8
1 455
8
0 507
8
2
8
1 507
8
0 142
8
2
8
1 142
8
0 783
8
2
8
1 783
8
0 998
8
2
8
1 998
8
0 161
8
2
8
1 161
8
0 935
8
2
8
1 935
8
0 62
8
2
8
1 62
8
0 680
8
2
8
1 680
8
0 146
8
2
8
1 146
8
0 810
8
...

result:

ok 

Test #25:

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

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 822
8
2
8
0 258
8
2
8
0 529
8
2
8
0 244
8
2
8
0 747
8
2
8
0 455
8
2
8
0 507
8
2
8
0 142
8
2
8
0 783
8
2
8
0 998
8
2
8
0 161
8
2
8
0 935
8
2
8
0 62
8
2
8
0 680
8
2
8
0 146
8
2
8
0 810
8
2
8
0 958
8
2
8
0 13
8
2
8
0 800
8
2
8
0 627
8
2
8
0 908
8
2
8
0 325
8
2
8
0 647
8
2
8
0 74
8
2
8
0 517
8
2
8
0...

result:

ok 

Test #26:

score: 15
Accepted
time: 12ms
memory: 4196kb

input:

999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
2
2
2
2
2
2
2
1
1
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
1
1
1
2
2
2
2
1
2
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
2
2
2
2
2
1
2
2
2
2
2
2
1
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
...

output:

8
0 852
8
2
8
0 259
8
2
8
0 574
8
2
8
0 245
8
2
8
0 261
8
2
8
0 450
8
2
8
0 179
8
2
8
0 848
8
2
8
0 344
8
2
8
0 398
8
2
8
0 310
8
2
8
0 381
8
2
8
0 63
8
2
8
0 681
8
2
8
0 147
8
2
8
0 811
8
2
8
0 959
8
2
8
0 33
8
2
8
1 33
8
0 801
8
2
8
0 488
8
2
8
1 488
8
0 909
8
2
8
1 909
8
0 546
8
2
8
1 546
8
0 460...

result:

ok 

Test #27:

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

input:

999
1
1
1
1
1
1
2
1
1
1
2
1
1
2
2
1
1
2
1
1
1
1
1
2
2
2
2
2
2
2
2
1
2
1
2
2
1
2
2
1
1
2
2
1
2
2
1
2
1
2
2
2
2
2
1
2
2
1
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
1
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
...

output:

8
0 893
8
2
8
0 307
8
2
8
0 561
8
2
8
0 144
8
2
8
0 840
8
2
8
0 332
8
2
8
0 76
8
2
8
1 76
8
0 330
8
2
8
0 879
8
2
8
0 671
8
2
8
0 363
8
2
8
1 363
8
0 542
8
2
8
0 496
8
2
8
0 809
8
2
8
1 809
8
0 17
8
2
8
1 17
8
0 632
8
2
8
0 176
8
2
8
0 508
8
2
8
1 508
8
0 109
8
2
8
0 697
8
2
8
0 56
8
2
8
0 88
8
2
8
...

result:

ok 

Test #28:

score: 15
Accepted
time: 14ms
memory: 3900kb

input:

996
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 892
8
2
8
0 306
8
2
8
1 306
8
0 560
8
2
8
1 560
8
0 249
8
2
8
1 249
8
0 147
8
2
8
1 147
8
0 174
8
2
8
1 174
8
0 38
8
2
8
1 38
8
0 407
8
2
8
1 407
8
0 878
8
2
8
1 878
8
0 779
8
2
8
1 779
8
0 362
8
2
8
1 362
8
0 275
8
2
8
1 275
8
0 25
8
2
8
1 25
8
0 808
8
2
8
1 808
8
0 1
8
2
8
1 1
8
0 83
8
2
8
1 8...

result:

ok 

Test #29:

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

input:

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

output:

8
0 893
8
2
8
0 307
8
2
8
0 561
8
2
8
0 144
8
2
8
0 840
8
2
8
0 332
8
2
8
0 76
8
2
8
1 76
8
0 330
8
2
8
1 330
8
0 879
8
2
8
1 879
8
0 671
8
2
8
1 671
8
0 363
8
2
8
0 542
8
2
8
0 496
8
2
8
1 496
8
0 809
8
2
8
0 17
8
2
8
0 632
8
2
8
1 632
8
0 176
8
2
8
0 508
8
2
8
0 109
8
2
8
1 109
8
0 697
8
2
8
1 697...

result:

ok 

Test #30:

score: 15
Accepted
time: 11ms
memory: 4192kb

input:

998
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 377
8
2
8
0 299
8
2
8
1 299
8
0 818
8
2
8
0 926
8
2
8
0 284
8
2
8
1 284
8
0 765
8
2
8
1 765
8
0 62
8
2
8
1 62
8
0 448
8
2
8
1 448
8
0 393
8
2
8
1 393
8
0 732
8
2
8
1 732
8
0 477
8
2
8
1 477
8
0 879
8
2
8
1 879
8
0 583
8
2
8
0 882
8
2
8
1 882
8
0 483
8
2
8
1 483
8
0 807
8
2
8
1 807
8
0 474
8
2
8
...

result:

ok 

Test #31:

score: 15
Accepted
time: 13ms
memory: 3912kb

input:

998
1
1
1
1
1
2
1
1
2
1
1
1
2
2
1
2
1
1
2
1
1
2
2
1
2
2
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
1
2
2
1
1
2
1
1
2
2
1
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
1
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
1
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 377
8
2
8
0 299
8
2
8
0 818
8
2
8
0 926
8
2
8
0 284
8
2
8
0 765
8
2
8
1 765
8
0 62
8
2
8
0 448
8
2
8
0 393
8
2
8
1 393
8
0 732
8
2
8
0 477
8
2
8
0 879
8
2
8
0 583
8
2
8
1 583
8
0 882
8
2
8
1 882
8
0 483
8
2
8
0 807
8
2
8
1 807
8
0 474
8
2
8
0 636
8
2
8
0 686
8
2
8
1 686
8
0 638
8
2
8
0 898
8
2
8...

result:

ok 

Test #32:

score: 15
Accepted
time: 8ms
memory: 3892kb

input:

1000
1
1
1
2
2
2
2
2
1
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
2
2
2
2...

output:

8
0 377
8
2
8
0 299
8
2
8
0 818
8
2
8
0 926
8
2
8
1 926
8
0 284
8
2
8
1 284
8
0 765
8
2
8
1 765
8
0 62
8
2
8
1 62
8
0 448
8
2
8
1 448
8
0 393
8
2
8
0 732
8
2
8
1 732
8
0 477
8
2
8
1 477
8
0 879
8
2
8
0 583
8
2
8
1 583
8
0 882
8
2
8
1 882
8
0 483
8
2
8
1 483
8
0 807
8
2
8
1 807
8
0 474
8
2
8
1 474
8
...

result:

ok 

Test #33:

score: 15
Accepted
time: 5ms
memory: 3904kb

input:

996
1
2
1
2
1
2
2
2
1
1
1
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 564
8
2
8
0 428
8
2
8
1 428
8
0 362
8
2
8
0 748
8
2
8
1 748
8
0 794
8
2
8
0 341
8
2
8
1 341
8
0 322
8
2
8
1 322
8
0 710
8
2
8
1 710
8
0 699
8
2
8
0 658
8
2
8
0 369
8
2
8
0 951
8
2
8
1 951
8
0 360
8
2
8
1 360
8
0 454
8
2
8
1 454
8
0 396
8
2
8
0 76
8
2
8
0 700
8
2
8
1 700
8
0 209
8
2
8
1 209
8
0 3...

result:

ok 

Test #34:

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

input:

1000
1
1
1
1
1
2
1
1
2
2
2
1
1
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 564
8
2
8
0 428
8
2
8
0 362
8
2
8
0 748
8
2
8
0 794
8
2
8
0 341
8
2
8
1 341
8
0 322
8
2
8
0 710
8
2
8
0 699
8
2
8
1 699
8
0 658
8
2
8
1 658
8
0 369
8
2
8
1 369
8
0 951
8
2
8
0 360
8
2
8
0 454
8
2
8
1 454
8
0 396
8
2
8
1 396
8
0 76
8
2
8
0 700
8
2
8
1 700
8
0 209
8
2
8
1 209
8
0 3
8
2
8
1 3
8
0 5...

result:

ok 

Test #35:

score: 15
Accepted
time: 19ms
memory: 3892kb

input:

1000
1
1
1
1
1
1
1
2
1
1
2
1
2
1
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...

output:

8
0 564
8
2
8
0 428
8
2
8
0 362
8
2
8
0 748
8
2
8
0 794
8
2
8
0 341
8
2
8
0 322
8
2
8
0 710
8
2
8
1 710
8
0 699
8
2
8
0 658
8
2
8
0 369
8
2
8
1 369
8
0 951
8
2
8
0 360
8
2
8
1 360
8
0 454
8
2
8
0 396
8
2
8
1 396
8
0 76
8
2
8
1 76
8
0 700
8
2
8
1 700
8
0 209
8
2
8
1 209
8
0 3
8
2
8
1 3
8
0 527
8
2
8
...

result:

ok 

Test #36:

score: 15
Accepted
time: 0ms
memory: 3932kb

input:

997
1
1
2
1
1
1
1
2
2
2
2
1
2
1
1
1
2
2
1
1
2
2
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 536
8
2
8
0 509
8
2
8
0 114
8
2
8
1 114
8
0 37
8
2
8
0 33
8
2
8
0 345
8
2
8
0 97
8
2
8
0 734
8
2
8
1 734
8
0 213
8
2
8
1 213
8
0 439
8
2
8
1 439
8
0 581
8
2
8
1 581
8
0 764
8
2
8
0 958
8
2
8
1 958
8
0 865
8
2
8
0 994
8
2
8
0 741
8
2
8
0 320
8
2
8
1 320
8
0 379
8
2
8
1 379
8
0 836
8
2
8
0 830
8
2...

result:

ok 

Test #37:

score: 15
Accepted
time: 5ms
memory: 4188kb

input:

995
1
1
1
1
2
2
1
1
1
1
1
1
2
1
1
1
1
2
1
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
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
...

output:

8
0 536
8
2
8
0 509
8
2
8
0 114
8
2
8
0 37
8
2
8
0 33
8
2
8
1 33
8
0 345
8
2
8
1 345
8
0 97
8
2
8
0 734
8
2
8
0 213
8
2
8
0 439
8
2
8
0 581
8
2
8
0 764
8
2
8
0 958
8
2
8
1 958
8
0 865
8
2
8
0 994
8
2
8
0 741
8
2
8
0 320
8
2
8
0 379
8
2
8
1 379
8
0 836
8
2
8
0 830
8
2
8
1 830
8
0 576
8
2
8
1 576
8
0 ...

result:

ok 

Test #38:

score: 15
Accepted
time: 12ms
memory: 3908kb

input:

997
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
2
1
1
2
2
2
1
1
1
2
2
2
1
2
1
1
2
2
2
2
2
2
2
1
1
2
2
2
1
2
2
1
2
2
1
1
2
1
2
2
2
2
2
1
2
1
2
1
1
1
2
2
2
2
2
2
2
2
2
1
2
1
2
2
1
2
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
1
2
2
2
1
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
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
...

output:

8
0 536
8
2
8
0 509
8
2
8
0 114
8
2
8
0 37
8
2
8
0 33
8
2
8
0 345
8
2
8
0 97
8
2
8
0 734
8
2
8
1 734
8
0 213
8
2
8
0 439
8
2
8
0 581
8
2
8
0 764
8
2
8
0 958
8
2
8
0 865
8
2
8
0 994
8
2
8
0 741
8
2
8
0 320
8
2
8
0 379
8
2
8
1 379
8
0 836
8
2
8
0 830
8
2
8
0 576
8
2
8
1 576
8
0 214
8
2
8
1 214
8
0 573...

result:

ok 

Test #39:

score: 15
Accepted
time: 3ms
memory: 3904kb

input:

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

output:

8
0 536
8
2
8
0 509
8
2
8
0 114
8
2
8
0 37
8
2
8
0 33
8
2
8
0 345
8
2
8
0 97
8
2
8
0 734
8
2
8
0 213
8
2
8
0 439
8
2
8
0 581
8
2
8
0 764
8
2
8
0 958
8
2
8
0 865
8
2
8
0 994
8
2
8
1 994
8
0 741
8
2
8
0 320
8
2
8
0 379
8
2
8
0 836
8
2
8
0 830
8
2
8
0 576
8
2
8
0 214
8
2
8
0 573
8
2
8
0 938
8
2
8
1 938...

result:

ok 

Test #40:

score: 15
Accepted
time: 8ms
memory: 3888kb

input:

996
1
1
1
1
1
1
1
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
2
1
1
2
2
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
2
2
1
1
1
1
2
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
2
1
2
1
1
2
1
2
1
1
1
2
1
2
1
2
1
2
1
2
2
1
1
2
1
2
2
2
2
2
1
2
2
2
1
1
2
1
1
2
2
2
2
2
1
1
2
1
1
2
1
2
2
1
2
2
1
1
2
2
1
1
2
2
2
2
1
...

output:

8
0 360
8
2
8
0 463
8
2
8
0 995
8
2
8
0 908
8
2
8
0 58
8
2
8
0 491
8
2
8
0 54
8
2
8
0 796
8
2
8
0 407
8
2
8
0 881
8
2
8
0 203
8
2
8
0 214
8
2
8
0 993
8
2
8
0 974
8
2
8
0 46
8
2
8
0 811
8
2
8
0 718
8
2
8
0 851
8
2
8
0 816
8
2
8
0 594
8
2
8
0 956
8
2
8
0 382
8
2
8
0 771
8
2
8
0 253
8
2
8
0 432
8
2
8
0...

result:

ok 

Test #41:

score: 15
Accepted
time: 5ms
memory: 3960kb

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
2
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
2
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
1
1
2
1
1
1
2
1
1
1
1
1
2
1
1
1
1
2
1
1
1
1
2
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
2
1
2
2
1
1
1
1
1
2
1
2
2
1
2
2
1
1
2
1
1
...

output:

8
0 361
8
2
8
0 127
8
2
8
0 124
8
2
8
0 909
8
2
8
0 748
8
2
8
0 162
8
2
8
0 510
8
2
8
0 797
8
2
8
0 265
8
2
8
0 762
8
2
8
0 78
8
2
8
0 215
8
2
8
0 483
8
2
8
0 975
8
2
8
0 150
8
2
8
0 199
8
2
8
0 719
8
2
8
0 543
8
2
8
0 817
8
2
8
0 595
8
2
8
0 957
8
2
8
0 383
8
2
8
0 476
8
2
8
0 217
8
2
8
0 808
8
2
8...

result:

ok 

Test #42:

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

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
2
1
1
2
2
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
2
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
2
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
2
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

8
0 361
8
2
8
0 127
8
2
8
0 124
8
2
8
0 909
8
2
8
0 748
8
2
8
0 162
8
2
8
0 510
8
2
8
0 797
8
2
8
0 265
8
2
8
0 762
8
2
8
0 78
8
2
8
0 215
8
2
8
0 483
8
2
8
0 975
8
2
8
0 150
8
2
8
0 199
8
2
8
0 719
8
2
8
0 543
8
2
8
0 817
8
2
8
0 595
8
2
8
0 957
8
2
8
0 383
8
2
8
0 476
8
2
8
0 217
8
2
8
0 808
8
2
8...

result:

ok 

Subtask #3:

score: 22.5
Acceptable Answer

Test #43:

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

input:

2
1
2
1
2
1
2

output:

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

result:

ok 

Test #44:

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

input:

2
1
1
1
1

output:

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

result:

ok 

Test #45:

score: 75
Accepted
time: 1ms
memory: 4160kb

input:

3
1
1
2
1
1
2

output:

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

result:

ok 

Test #46:

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

input:

6
1
1
2
2
2
2
1
1
2
3
3
3
1
1
2
2
2
2

output:

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

result:

ok 

Test #47:

score: 70.33
Acceptable Answer
time: 0ms
memory: 3844kb

input:

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

output:

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

result:

points 0.93773333330 points  0.93773333330

Test #48:

score: 22.5
Acceptable Answer
time: 18ms
memory: 3904kb

input:

2000
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 360
8
2
8
0 463
8
2
8
1 463
8
0 995
8
2
8
1 995
8
0 1484
8
2
8
1 1484
8
0 1087
8
2
8
1 1087
8
0 1840
8
2
8
1 1840
8
0 54
8
2
8
1 54
8
0 796
8
2
8
1 796
8
0 407
8
2
8
1 407
8
0 1973
8
2
8
1 1973
8
0 1067
8
2
8
1 1067
8
0 214
8
2
8
1 214
8
0 1894
8
2
8
1 1894
8
0 1094
8
2
8
1 1094
8
0 46
8
2
8
1 4...

result:

points 0.30 points  0.30

Test #49:

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

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 1694
8
2
8
0 1575
8
2
8
0 327
8
2
8
0 1716
8
2
8
0 1078
8
2
8
0 1293
8
2
8
0 1111
8
2
8
0 1335
8
2
8
0 317
8
2
8
0 1506
8
2
8
0 1794
8
2
8
0 617
8
2
8
0 883
8
2
8
0 1527
8
2
8
0 930
8
2
8
0 1879
8
2
8
0 1129
8
2
8
0 451
8
2
8
0 1313
8
2
8
0 1680
8
2
8
0 1408
8
2
8
0 1084
8
2
8
0 441
8
2
8
0 1838...

result:

ok 

Test #50:

score: 45
Acceptable Answer
time: 41ms
memory: 3900kb

input:

2000
1
2
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
2
2
1
1
1
1
2
2
2
2
2
1
2
2
1
1
1
2
1
1
1
2
1
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
1
2
1
2
1
2
2
2
1
2
2
1
2
1
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
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1694
8
2
8
0 1575
8
2
8
1 1575
8
0 327
8
2
8
0 1716
8
2
8
0 1078
8
2
8
0 1293
8
2
8
0 1111
8
2
8
0 1335
8
2
8
0 317
8
2
8
0 1506
8
2
8
0 1794
8
2
8
0 617
8
2
8
0 883
8
2
8
0 1527
8
2
8
1 1527
8
0 930
8
2
8
0 1879
8
2
8
0 1129
8
2
8
0 451
8
2
8
0 1313
8
2
8
1 1313
8
0 1680
8
2
8
1 1680
8
0 1408
8...

result:

points 0.60 points  0.60

Test #51:

score: 57.31
Acceptable Answer
time: 18ms
memory: 3844kb

input:

2000
1
1
1
1
1
1
1
1
1
2
1
1
1
1
2
2
1
1
2
1
1
2
1
1
1
2
2
2
1
1
2
2
2
1
2
1
2
2
2
2
1
2
2
2
2
2
2
1
2
1
2
1
2
2
2
2
2
1
2
2
2
1
2
2
1
1
1
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
1
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
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...

output:

8
0 1793
8
2
8
0 598
8
2
8
0 930
8
2
8
0 661
8
2
8
0 1918
8
2
8
0 1640
8
2
8
0 1099
8
2
8
0 987
8
2
8
0 1618
8
2
8
0 1850
8
2
8
1 1850
8
0 50
8
2
8
0 12
8
2
8
0 1668
8
2
8
0 625
8
2
8
0 966
8
2
8
1 966
8
0 190
8
2
8
1 190
8
0 1859
8
2
8
0 557
8
2
8
0 643
8
2
8
1 643
8
0 11
8
2
8
0 321
8
2
8
0 1901
8...

result:

points 0.76413333330 points  0.76413333330

Test #52:

score: 26.43
Acceptable Answer
time: 23ms
memory: 3900kb

input:

2000
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 1793
8
2
8
0 598
8
2
8
1 598
8
0 930
8
2
8
1 930
8
0 661
8
2
8
1 661
8
0 1918
8
2
8
1 1918
8
0 1640
8
2
8
1 1640
8
0 1099
8
2
8
1 1099
8
0 987
8
2
8
1 987
8
0 1618
8
2
8
1 1618
8
0 1850
8
2
8
1 1850
8
0 50
8
2
8
1 50
8
0 12
8
2
8
1 12
8
0 1668
8
2
8
1 1668
8
0 625
8
2
8
1 625
8
0 966
8
2
8
1 966...

result:

points 0.35240 points  0.35240

Test #53:

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

input:

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

output:

8
0 1227
8
2
8
0 648
8
2
8
1 648
8
0 649
8
2
8
0 408
8
2
8
1 408
8
0 841
8
2
8
1 841
8
0 1104
8
2
8
1 1104
8
0 1423
8
2
8
1 1423
8
0 755
8
2
8
0 237
8
2
8
1 237
8
0 1458
8
2
8
0 59
8
2
8
0 724
8
2
8
1 724
8
0 1344
8
2
8
1 1344
8
0 978
8
2
8
1 978
8
0 1238
8
2
8
1 1238
8
0 293
8
2
8
1 293
8
0 1401
8
...

result:

ok 

Test #54:

score: 28.8
Acceptable Answer
time: 22ms
memory: 3932kb

input:

2000
1
2
1
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
2
2
2
2
2
2...

output:

8
0 1227
8
2
8
0 648
8
2
8
1 648
8
0 649
8
2
8
0 408
8
2
8
1 408
8
0 841
8
2
8
0 1104
8
2
8
1 1104
8
0 1423
8
2
8
1 1423
8
0 755
8
2
8
1 755
8
0 237
8
2
8
1 237
8
0 1458
8
2
8
0 59
8
2
8
1 59
8
0 724
8
2
8
1 724
8
0 1344
8
2
8
1 1344
8
0 978
8
2
8
1 978
8
0 1238
8
2
8
1 1238
8
0 293
8
2
8
1 293
8
0 ...

result:

points 0.3840 points  0.3840

Test #55:

score: 57.13
Acceptable Answer
time: 26ms
memory: 3932kb

input:

2000
1
1
1
1
1
1
1
1
2
1
2
1
1
1
1
1
1
1
1
1
2
2
2
2
2
1
2
1
2
2
1
2
2
2
1
2
1
1
1
1
2
1
1
2
2
2
1
2
1
2
2
2
2
2
1
2
1
2
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
1
1
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
1
2
2
2
2
2
2...

output:

8
0 105
8
2
8
0 1614
8
2
8
0 361
8
2
8
0 997
8
2
8
0 787
8
2
8
0 1426
8
2
8
0 1225
8
2
8
0 186
8
2
8
0 1271
8
2
8
1 1271
8
0 324
8
2
8
0 134
8
2
8
1 134
8
0 1144
8
2
8
0 1340
8
2
8
0 1580
8
2
8
0 1923
8
2
8
0 1925
8
2
8
0 1870
8
2
8
0 1437
8
2
8
0 645
8
2
8
0 1370
8
2
8
0 1609
8
2
8
1 1609
8
0 19
8
...

result:

points 0.76173333330 points  0.76173333330

Test #56:

score: 32.19
Acceptable Answer
time: 19ms
memory: 3960kb

input:

1998
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 219
8
2
8
0 796
8
2
8
0 1000
8
2
8
0 1321
8
2
8
1 1321
8
0 1833
8
2
8
0 1514
8
2
8
0 959
8
2
8
1 959
8
0 1814
8
2
8
1 1814
8
0 1409
8
2
8
1 1409
8
0 1153
8
2
8
1 1153
8
0 701
8
2
8
1 701
8
0 702
8
2
8
1 702
8
0 710
8
2
8
1 710
8
0 1142
8
2
8
1 1142
8
0 1122
8
2
8
1 1122
8
0 157
8
2
8
1 157
8
0 9...

result:

points 0.42920 points  0.42920

Test #57:

score: 32.16
Acceptable Answer
time: 17ms
memory: 3912kb

input:

1999
1
1
2
2
1
1
1
2
2
2
1
1
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 252
8
2
8
0 1424
8
2
8
0 1388
8
2
8
1 1388
8
0 1996
8
2
8
1 1996
8
0 1047
8
2
8
0 1517
8
2
8
0 467
8
2
8
0 1817
8
2
8
1 1817
8
0 1414
8
2
8
1 1414
8
0 508
8
2
8
1 508
8
0 1836
8
2
8
0 1026
8
2
8
0 1294
8
2
8
1 1294
8
0 1143
8
2
8
1 1143
8
0 1123
8
2
8
1 1123
8
0 652
8
2
8
0 821
8
2
8
1 821
8
0 1...

result:

points 0.42880 points  0.42880

Test #58:

score: 32.16
Acceptable Answer
time: 25ms
memory: 3844kb

input:

1997
1
1
1
1
1
1
1
1
2
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
2
2
2
2
2
2
2
2
2
2
2
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 277
8
2
8
0 1805
8
2
8
0 347
8
2
8
0 1185
8
2
8
0 464
8
2
8
0 137
8
2
8
0 1462
8
2
8
0 1481
8
2
8
0 1780
8
2
8
1 1780
8
0 96
8
2
8
0 870
8
2
8
1 870
8
0 463
8
2
8
1 463
8
0 188
8
2
8
1 188
8
0 1008
8
2
8
1 1008
8
0 874
8
2
8
1 874
8
0 1358
8
2
8
1 1358
8
0 87
8
2
8
0 1238
8
2
8
1 1238
8
0 207
8
...

result:

points 0.42880 points  0.42880

Test #59:

score: 37.52
Acceptable Answer
time: 36ms
memory: 3896kb

input:

1998
1
1
1
1
1
1
2
1
1
1
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
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...

output:

8
0 1126
8
2
8
0 1205
8
2
8
0 396
8
2
8
0 703
8
2
8
0 1216
8
2
8
0 1277
8
2
8
0 1289
8
2
8
1 1289
8
0 1270
8
2
8
0 818
8
2
8
0 66
8
2
8
0 518
8
2
8
1 518
8
0 1772
8
2
8
0 553
8
2
8
1 553
8
0 1221
8
2
8
0 1046
8
2
8
1 1046
8
0 808
8
2
8
1 808
8
0 112
8
2
8
1 112
8
0 1409
8
2
8
1 1409
8
0 46
8
2
8
1 4...

result:

points 0.50026666670 points  0.50026666670

Test #60:

score: 32.14
Acceptable Answer
time: 16ms
memory: 3868kb

input:

1996
1
1
1
1
2
1
1
1
2
1
1
1
2
2
2
1
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 593
8
2
8
0 1290
8
2
8
0 1610
8
2
8
0 177
8
2
8
0 46
8
2
8
1 46
8
0 1167
8
2
8
0 16
8
2
8
0 1275
8
2
8
0 1941
8
2
8
1 1941
8
0 566
8
2
8
0 787
8
2
8
0 841
8
2
8
0 1142
8
2
8
1 1142
8
0 343
8
2
8
1 343
8
0 1319
8
2
8
1 1319
8
0 646
8
2
8
0 279
8
2
8
1 279
8
0 171
8
2
8
0 76
8
2
8
1 76
8
0 1379
8
...

result:

points 0.42853333330 points  0.42853333330

Test #61:

score: 37.53
Acceptable Answer
time: 23ms
memory: 3912kb

input:

2000
1
1
1
1
1
2
1
2
1
1
1
1
1
1
2
2
2
2
2
1
2
1
1
2
2
2
2
2
2
2
2
1
2
2
2
2
1
2
2
2
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
2
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 593
8
2
8
0 1290
8
2
8
0 1610
8
2
8
0 177
8
2
8
0 46
8
2
8
0 1167
8
2
8
1 1167
8
0 16
8
2
8
0 1275
8
2
8
1 1275
8
0 1941
8
2
8
0 566
8
2
8
0 787
8
2
8
0 841
8
2
8
0 1142
8
2
8
0 343
8
2
8
0 1319
8
2
8
1 1319
8
0 646
8
2
8
1 646
8
0 279
8
2
8
1 279
8
0 171
8
2
8
1 171
8
0 76
8
2
8
1 76
8
0 1379
8...

result:

points 0.50040 points  0.50040

Test #62:

score: 57.06
Acceptable Answer
time: 9ms
memory: 3908kb

input:

1998
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
2
1
1
1
1
2
1
1
1
1
1
2
1
2
2
1
1
2
2
1
2
1
1
1
2
2
1
2
2
2
1
1
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
1
2
2
2
2
2
2
2
2
1
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
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 292
8
2
8
0 570
8
2
8
0 46
8
2
8
0 1298
8
2
8
0 923
8
2
8
0 1653
8
2
8
0 1210
8
2
8
0 1679
8
2
8
0 873
8
2
8
0 146
8
2
8
0 1028
8
2
8
0 24
8
2
8
1 24
8
0 95
8
2
8
0 786
8
2
8
0 201
8
2
8
0 943
8
2
8
0 1433
8
2
8
0 195
8
2
8
0 837
8
2
8
0 1626
8
2
8
1 1626
8
0 211
8
2
8
1 211
8
0 1972
8
2
8
0 121...

result:

points 0.76080 points  0.76080

Test #63:

score: 64.37
Acceptable Answer
time: 10ms
memory: 3820kb

input:

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

output:

8
0 588
8
2
8
0 72
8
2
8
0 1535
8
2
8
0 622
8
2
8
0 720
8
2
8
0 1784
8
2
8
0 1492
8
2
8
1 1492
8
0 976
8
2
8
0 596
8
2
8
0 228
8
2
8
0 1383
8
2
8
0 1770
8
2
8
0 310
8
2
8
0 860
8
2
8
1 860
8
0 699
8
2
8
0 936
8
2
8
0 263
8
2
8
0 995
8
2
8
0 990
8
2
8
0 434
8
2
8
0 1916
8
2
8
1 1916
8
0 735
8
2
8
0 8...

result:

points 0.85826666670 points  0.85826666670

Test #64:

score: 70.36
Acceptable Answer
time: 12ms
memory: 3868kb

input:

1995
1
1
1
1
1
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
2
1
1
1
1
2
1
1
1
1
1
2
1
2
1
1
1
1
1
2
1
2
1
1
2
1
2
2
1
1
2
2
1
1
1
2
1
1
1
2
2
2
2
2
1
1
1
2
1
1
1
2
2
2
2
2
2
2
2
1
1
2
2
1
1
1
1
1
1
1
1
1
2
1
1
2
1
1
1
1
1
1
2
2
2
1
1
2
2
2
1
1
2
2
1
1
2
1
2
2
2
1
2
2
1
1
1
2
1
1
2
2
2
2
1
1...

output:

8
0 826
8
2
8
0 406
8
2
8
0 714
8
2
8
0 623
8
2
8
0 721
8
2
8
0 1785
8
2
8
0 1493
8
2
8
0 977
8
2
8
0 1670
8
2
8
0 229
8
2
8
0 657
8
2
8
0 1771
8
2
8
0 713
8
2
8
0 1118
8
2
8
0 172
8
2
8
0 937
8
2
8
0 132
8
2
8
0 1170
8
2
8
0 991
8
2
8
0 435
8
2
8
0 1917
8
2
8
0 387
8
2
8
0 811
8
2
8
0 1782
8
2
8
0 ...

result:

points 0.93813333330 points  0.93813333330

Test #65:

score: 75
Accepted
time: 6ms
memory: 4184kb

input:

1999
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
2
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
2
1
1
1
1
1
2
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
2
1
1
1
1
1
2
1
1
1
2
1
1
1
1
2
1
1
2
1
1
1
2
1
2
1
1
1
1
1
1
2
2
2
1
1
2
2
1
1
1
1
2
1
1
1
1
2
1
1
1
1
2
1
2
1
1
2
1
1
2
2
1
1...

output:

8
0 826
8
2
8
0 406
8
2
8
0 714
8
2
8
0 623
8
2
8
0 721
8
2
8
0 1785
8
2
8
1 1785
8
0 1493
8
2
8
0 977
8
2
8
0 1670
8
2
8
0 229
8
2
8
0 657
8
2
8
0 1771
8
2
8
0 713
8
2
8
0 1118
8
2
8
0 172
8
2
8
0 937
8
2
8
1 937
8
0 132
8
2
8
0 1170
8
2
8
0 991
8
2
8
0 435
8
2
8
0 1917
8
2
8
0 387
8
2
8
0 811
8
2
...

result:

ok 

Test #66:

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

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
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
2
1
2
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
1
1
1
1
1
1
1
1
1
1
2
2
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...

output:

8
0 1939
8
2
8
0 551
8
2
8
0 1792
8
2
8
0 370
8
2
8
0 369
8
2
8
0 1936
8
2
8
0 1184
8
2
8
0 190
8
2
8
0 417
8
2
8
0 1195
8
2
8
0 420
8
2
8
0 664
8
2
8
0 1191
8
2
8
0 468
8
2
8
0 1270
8
2
8
0 1012
8
2
8
0 1914
8
2
8
0 1455
8
2
8
0 1350
8
2
8
0 1962
8
2
8
0 630
8
2
8
0 384
8
2
8
0 772
8
2
8
0 1755
8
2...

result:

ok 

Test #67:

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

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
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
2
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
1
1
1
1
1
1
1
1
1...

output:

8
0 578
8
2
8
0 924
8
2
8
0 1793
8
2
8
0 514
8
2
8
0 1570
8
2
8
0 1937
8
2
8
0 1185
8
2
8
0 390
8
2
8
0 1756
8
2
8
0 1578
8
2
8
0 421
8
2
8
0 665
8
2
8
0 1140
8
2
8
0 469
8
2
8
0 1271
8
2
8
0 1013
8
2
8
0 1915
8
2
8
0 435
8
2
8
0 1351
8
2
8
0 1963
8
2
8
0 631
8
2
8
0 560
8
2
8
0 773
8
2
8
0 328
8
2
...

result:

ok 

Test #68:

score: 45
Acceptable Answer
time: 28ms
memory: 3900kb

input:

1979
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
2
1
1
1
1
2
1
1
1
2
2
1
2
2
2
1
2
2
2
2
1
1
1
1
2
1
2
1
2
2
1
1
2
1
2
1
2
2
2
2
1
2
2
2
2
2
2
1
2
2
2
1
1
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
1
2
2
1
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
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
1
2
2
2...

output:

8
0 578
8
2
8
0 924
8
2
8
0 1793
8
2
8
0 514
8
2
8
0 1570
8
2
8
0 1937
8
2
8
0 1185
8
2
8
0 390
8
2
8
1 390
8
0 1756
8
2
8
0 1578
8
2
8
0 421
8
2
8
0 665
8
2
8
0 1140
8
2
8
0 469
8
2
8
0 1271
8
2
8
0 1013
8
2
8
0 1915
8
2
8
0 435
8
2
8
0 1351
8
2
8
0 1963
8
2
8
0 631
8
2
8
0 560
8
2
8
0 773
8
2
8
0 ...

result:

points 0.60 points  0.60

Test #69:

score: 45
Acceptable Answer
time: 10ms
memory: 4160kb

input:

1979
1
1
1
1
1
1
1
1
1
2
1
2
1
1
1
2
2
1
1
1
1
2
2
1
1
2
1
1
2
1
1
1
1
1
1
2
2
1
1
1
2
1
2
1
2
2
2
2
1
2
1
1
1
2
2
1
2
2
1
2
1
1
2
1
1
2
1
2
1
2
1
1
2
1
2
1
2
2
1
2
2
2
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
1
2
1
2
2
2
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...

output:

8
0 265
8
2
8
0 1277
8
2
8
0 351
8
2
8
0 1217
8
2
8
0 1964
8
2
8
0 1229
8
2
8
0 877
8
2
8
0 1967
8
2
8
0 766
8
2
8
0 1406
8
2
8
1 1406
8
0 1517
8
2
8
0 1445
8
2
8
1 1445
8
0 0
8
2
8
0 137
8
2
8
0 1666
8
2
8
0 1408
8
2
8
1 1408
8
0 312
8
2
8
1 312
8
0 164
8
2
8
0 780
8
2
8
0 535
8
2
8
0 1761
8
2
8
0 ...

result:

points 0.60 points  0.60

Test #70:

score: 37.5
Acceptable Answer
time: 27ms
memory: 4196kb

input:

1979
1
1
1
1
1
1
1
2
1
1
1
1
2
1
1
1
1
1
1
2
2
1
2
1
2
2
2
1
2
2
2
2
2
1
1
2
2
2
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
1
2
2
2
2
2
1
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
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 265
8
2
8
0 1277
8
2
8
0 351
8
2
8
0 1217
8
2
8
0 1964
8
2
8
0 1229
8
2
8
0 877
8
2
8
0 1967
8
2
8
1 1967
8
0 766
8
2
8
0 1406
8
2
8
0 1517
8
2
8
0 1445
8
2
8
0 0
8
2
8
1 0
8
0 137
8
2
8
0 1666
8
2
8
0 1408
8
2
8
0 312
8
2
8
0 164
8
2
8
0 780
8
2
8
0 535
8
2
8
1 535
8
0 1761
8
2
8
1 1761
8
0 249...

result:

points 0.50 points  0.50

Test #71:

score: 37.5
Acceptable Answer
time: 19ms
memory: 3932kb

input:

1979
1
1
1
1
1
1
1
1
1
2
1
2
1
1
2
2
1
1
1
1
1
1
2
2
1
1
1
2
2
2
1
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
1
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...

output:

8
0 204
8
2
8
0 1753
8
2
8
0 391
8
2
8
0 1096
8
2
8
0 816
8
2
8
0 608
8
2
8
0 424
8
2
8
0 1515
8
2
8
0 591
8
2
8
0 1715
8
2
8
1 1715
8
0 1719
8
2
8
0 1531
8
2
8
1 1531
8
0 1182
8
2
8
0 151
8
2
8
0 1739
8
2
8
1 1739
8
0 1521
8
2
8
1 1521
8
0 1639
8
2
8
0 431
8
2
8
0 1554
8
2
8
0 1926
8
2
8
0 1073
8
2...

result:

points 0.50 points  0.50

Test #72:

score: 57.04
Acceptable Answer
time: 17ms
memory: 3868kb

input:

1981
1
1
1
1
1
1
1
1
1
2
1
2
1
1
1
1
2
1
2
1
1
1
1
2
2
1
2
1
2
1
2
1
2
2
1
1
2
1
1
1
2
1
1
2
2
2
1
2
2
1
2
2
1
1
1
1
2
2
1
1
1
2
1
1
2
1
2
1
2
1
2
2
2
2
2
2
2
2
2
1
2
1
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
1
1
2
2
2
1
2
2
2
2
2
2
1
2
2
1
2
2
1
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...

output:

8
0 231
8
2
8
0 1232
8
2
8
0 1067
8
2
8
0 889
8
2
8
0 1785
8
2
8
0 91
8
2
8
0 1909
8
2
8
0 1045
8
2
8
0 1177
8
2
8
0 174
8
2
8
1 174
8
0 1231
8
2
8
0 219
8
2
8
1 219
8
0 557
8
2
8
0 1138
8
2
8
0 383
8
2
8
0 437
8
2
8
0 1871
8
2
8
1 1871
8
0 584
8
2
8
0 548
8
2
8
1 548
8
0 13
8
2
8
0 694
8
2
8
0 727
...

result:

points 0.76053333330 points  0.76053333330

Test #73:

score: 57.04
Acceptable Answer
time: 8ms
memory: 4192kb

input:

1981
1
1
2
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
2
1
1
1
2
2
2
1
1
2
2
1
1
1
1
1
1
2
1
2
1
2
1
2
2
2
1
2
1
1
1
1
2
2
2
2
2
2
2
1
2
1
2
2
1
2
1
2
2
1
1
2
2
2
2
2
2
2
2
1
2
2
1
1
2
2
2
2
1
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 231
8
2
8
0 1232
8
2
8
0 1067
8
2
8
1 1067
8
0 889
8
2
8
0 1785
8
2
8
0 91
8
2
8
0 1909
8
2
8
0 1045
8
2
8
1 1045
8
0 1177
8
2
8
0 174
8
2
8
0 1231
8
2
8
0 219
8
2
8
0 557
8
2
8
0 1138
8
2
8
0 383
8
2
8
0 437
8
2
8
0 1871
8
2
8
0 584
8
2
8
0 548
8
2
8
0 13
8
2
8
0 694
8
2
8
0 727
8
2
8
1 727
8
0...

result:

points 0.76053333330 points  0.76053333330

Test #74:

score: 64.36
Acceptable Answer
time: 18ms
memory: 3904kb

input:

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

output:

8
0 828
8
2
8
0 1953
8
2
8
0 351
8
2
8
0 705
8
2
8
0 1102
8
2
8
0 406
8
2
8
1 406
8
0 1746
8
2
8
0 1911
8
2
8
0 1905
8
2
8
0 301
8
2
8
0 1461
8
2
8
1 1461
8
0 20
8
2
8
0 855
8
2
8
0 1524
8
2
8
1 1524
8
0 806
8
2
8
0 1457
8
2
8
0 751
8
2
8
1 751
8
0 54
8
2
8
0 149
8
2
8
0 1855
8
2
8
0 1676
8
2
8
0 74...

result:

points 0.85813333330 points  0.85813333330

Test #75:

score: 64.36
Acceptable Answer
time: 12ms
memory: 3864kb

input:

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

output:

8
0 828
8
2
8
0 1953
8
2
8
0 351
8
2
8
0 705
8
2
8
0 1102
8
2
8
0 406
8
2
8
1 406
8
0 1746
8
2
8
0 1911
8
2
8
0 1905
8
2
8
0 301
8
2
8
0 1461
8
2
8
1 1461
8
0 20
8
2
8
0 855
8
2
8
0 1524
8
2
8
1 1524
8
0 806
8
2
8
0 1457
8
2
8
0 751
8
2
8
1 751
8
0 54
8
2
8
0 149
8
2
8
0 1855
8
2
8
0 1676
8
2
8
0 74...

result:

points 0.85813333330 points  0.85813333330

Test #76:

score: 45
Acceptable Answer
time: 13ms
memory: 3912kb

input:

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

output:

8
0 234
8
2
8
0 292
8
2
8
0 1667
8
2
8
0 1307
8
2
8
0 432
8
2
8
0 299
8
2
8
1 299
8
0 339
8
2
8
0 356
8
2
8
1 356
8
0 993
8
2
8
0 1387
8
2
8
0 91
8
2
8
0 468
8
2
8
0 757
8
2
8
0 1332
8
2
8
0 894
8
2
8
0 1017
8
2
8
0 1575
8
2
8
0 1743
8
2
8
1 1743
8
0 71
8
2
8
1 71
8
0 1214
8
2
8
0 1835
8
2
8
0 1018
...

result:

points 0.60 points  0.60

Test #77:

score: 45
Acceptable Answer
time: 37ms
memory: 4192kb

input:

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

output:

8
0 234
8
2
8
0 292
8
2
8
0 1667
8
2
8
0 1307
8
2
8
0 432
8
2
8
0 299
8
2
8
0 339
8
2
8
0 356
8
2
8
0 993
8
2
8
0 1387
8
2
8
0 91
8
2
8
1 91
8
0 468
8
2
8
1 468
8
0 757
8
2
8
0 1332
8
2
8
0 894
8
2
8
0 1017
8
2
8
0 1575
8
2
8
0 1743
8
2
8
0 71
8
2
8
1 71
8
0 1214
8
2
8
0 1835
8
2
8
0 1018
8
2
8
1 10...

result:

points 0.60 points  0.60

Test #78:

score: 57.03
Acceptable Answer
time: 16ms
memory: 3888kb

input:

1980
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
2
1
1
2
2
2
1
1
2
1
2
1
1
1
2
2
1
2
2
1
1
2
2
1
2
2
1
2
2
2
1
1
1
1
2
1
1
2
2
1
2
1
2
2
2
2
2
1
1
1
2
2
2
2
2
2
2
1
2
1
2
1
2
1
1
1
2
1
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
2
2
1
2
2
2
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...

output:

8
0 360
8
2
8
0 1225
8
2
8
0 1968
8
2
8
0 897
8
2
8
0 809
8
2
8
0 1508
8
2
8
0 1487
8
2
8
1 1487
8
0 680
8
2
8
0 41
8
2
8
0 915
8
2
8
0 1668
8
2
8
0 1017
8
2
8
0 3
8
2
8
0 1295
8
2
8
0 1173
8
2
8
0 1280
8
2
8
1 1280
8
0 1657
8
2
8
0 1031
8
2
8
0 1275
8
2
8
0 1535
8
2
8
0 1051
8
2
8
0 752
8
2
8
0 665...

result:

points 0.76040 points  0.76040

Test #79:

score: 57.03
Acceptable Answer
time: 39ms
memory: 3824kb

input:

1980
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
2
1
1
2
2
2
1
1
2
2
2
1
1
1
2
2
1
2
2
1
1
2
2
1
2
2
1
1
2
2
1
1
1
1
2
1
1
2
2
1
2
1
2
2
2
2
2
1
1
1
2
2
1
2
2
2
2
1
2
1
2
1
2
1
1
1
2
1
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
2
2
1
2
2
2
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...

output:

8
0 360
8
2
8
0 1225
8
2
8
0 1968
8
2
8
0 897
8
2
8
0 809
8
2
8
0 1508
8
2
8
0 1487
8
2
8
1 1487
8
0 680
8
2
8
0 41
8
2
8
0 915
8
2
8
0 1668
8
2
8
0 1017
8
2
8
0 3
8
2
8
0 1295
8
2
8
0 1173
8
2
8
0 1280
8
2
8
1 1280
8
0 1657
8
2
8
0 1031
8
2
8
0 1275
8
2
8
0 1535
8
2
8
0 1051
8
2
8
0 752
8
2
8
0 665...

result:

points 0.76040 points  0.76040

Test #80:

score: 57
Acceptable Answer
time: 14ms
memory: 3976kb

input:

2000
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
2
1
1
1
2
2
1
1
1
1
1
2
2
2
1
2
2
2
1
1
2
1
1
1
2
1
1
2
1
1
1
1
2
1
1
1
2
2
2
1
2
2
1
1
2
1
2
1
2
2
1
2
2
2
1
2
1
2
1
1
2
1
1
1
2
1
1
2
2
1
1
1
1
2
1
1
1
2
2
2
1
2
2
1
1
1
2
2
1
1
2
1
1
2
2
2
2
2
2
1
1
2
2
2
2
1
1
1
2
1
1
2
2
2
2
1
1
1
1
1
2
1...

output:

8
0 1451
8
2
8
0 346
8
2
8
0 742
8
2
8
0 1934
8
2
8
0 1326
8
2
8
0 1067
8
2
8
0 1270
8
2
8
0 60
8
2
8
0 1460
8
2
8
0 1029
8
2
8
0 811
8
2
8
0 1452
8
2
8
0 1876
8
2
8
0 897
8
2
8
0 1308
8
2
8
0 1674
8
2
8
0 1620
8
2
8
0 132
8
2
8
0 1446
8
2
8
0 1188
8
2
8
0 1045
8
2
8
1 1045
8
0 83
8
2
8
0 1361
8
2
8...

result:

points 0.760 points  0.760

Test #81:

score: 57
Acceptable Answer
time: 32ms
memory: 3900kb

input:

2000
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
2
1
1
1
2
2
1
1
1
1
1
2
2
2
1
2
2
2
1
1
2
1
1
1
2
1
1
2
1
1
1
1
2
1
1
1
2
2
2
1
2
2
1
1
2
1
2
1
2
2
1
2
2
2
1
2
1
2
1
1
2
1
1
1
2
2
1
2
2
1
1
1
1
2
1
1
1
2
2
2
1
2
2
1
1
1
2
2
1
1
2
1
1
2
2
2
2
2
2
1
1
2
2
2
2
1
1
1
2
1
1
2
2
2
2
1
1
1
1
1
2
1...

output:

8
0 1451
8
2
8
0 346
8
2
8
0 742
8
2
8
0 1934
8
2
8
0 1326
8
2
8
0 1067
8
2
8
0 1270
8
2
8
0 60
8
2
8
0 1460
8
2
8
0 1029
8
2
8
0 811
8
2
8
0 1452
8
2
8
0 1876
8
2
8
0 897
8
2
8
0 1308
8
2
8
0 1674
8
2
8
0 1620
8
2
8
0 132
8
2
8
0 1446
8
2
8
0 1188
8
2
8
0 1045
8
2
8
1 1045
8
0 83
8
2
8
0 1361
8
2
8...

result:

points 0.760 points  0.760

Test #82:

score: 45
Acceptable Answer
time: 33ms
memory: 3964kb

input:

2000
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
2
1
1
1
1
2
1
1
2
1
1
1
1
2
2
2
2
1
1
2
1
1
1
2
2
1
1
1
2
2
2
2
1
1
1
2
2
2
2
2
1
2
2
1
1
1
1
2
1
2
1
2
2
1
2
1
2
2
1
2
2
1
1
2
2
2
2
2
2
2
2
1
2
1
2
2
2
2
1
2
1
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
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 793
8
2
8
0 393
8
2
8
0 1291
8
2
8
0 445
8
2
8
0 1686
8
2
8
0 830
8
2
8
0 1163
8
2
8
0 179
8
2
8
0 1720
8
2
8
0 1948
8
2
8
0 814
8
2
8
0 1091
8
2
8
0 114
8
2
8
1 114
8
0 204
8
2
8
0 55
8
2
8
0 363
8
2
8
0 999
8
2
8
1 999
8
0 726
8
2
8
0 957
8
2
8
0 1056
8
2
8
0 1391
8
2
8
0 500
8
2
8
1 500
8
0 7...

result:

points 0.60 points  0.60

Test #83:

score: 45
Acceptable Answer
time: 26ms
memory: 3900kb

input:

2000
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
2
1
2
1
1
1
1
2
1
1
2
2
2
1
1
1
1
2
2
2
2
1
2
2
1
2
1
2
1
1
2
1
1
1
1
1
1
2
2
2
2
1
2
1
1
2
2
2
1
1
1
1
2
2
1
1
2
2
1
2
2
1
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
1
2
2
2
2
2
2
2
2
2
2
1
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
1
2
1
2
2
2
2
2...

output:

8
0 793
8
2
8
0 393
8
2
8
0 1291
8
2
8
0 445
8
2
8
1 445
8
0 1686
8
2
8
0 830
8
2
8
0 1163
8
2
8
0 179
8
2
8
0 1720
8
2
8
0 1948
8
2
8
0 814
8
2
8
0 1091
8
2
8
0 114
8
2
8
0 204
8
2
8
0 55
8
2
8
0 363
8
2
8
1 363
8
0 999
8
2
8
0 726
8
2
8
1 726
8
0 957
8
2
8
0 1056
8
2
8
0 1391
8
2
8
0 500
8
2
8
0 7...

result:

points 0.60 points  0.60

Test #84:

score: 49.57
Acceptable Answer
time: 5ms
memory: 3908kb

input:

540
1
2
2
2
2
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 59
8
2
8
0 254
8
2
8
1 254
8
0 424
8
2
8
1 424
8
0 25
8
2
8
1 25
8
0 515
8
2
8
1 515
8
0 306
8
2
8
1 306
8
0 266
8
2
8
0 99
8
2
8
1 99
8
0 145
8
2
8
1 145
8
0 358
8
2
8
1 358
8
0 317
8
2
8
1 317
8
0 46
8
2
8
0 14
8
2
8
1 14
8
0 201
8
2
8
1 201
8
0 414
8
2
8
1 414
8
0 484
8
2
8
1 484
8
0 152
8
2
...

result:

points 0.66093333330 points  0.66093333330

Test #85:

score: 34.97
Acceptable Answer
time: 24ms
memory: 3888kb

input:

1834
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
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...

output:

8
0 59
8
2
8
0 1418
8
2
8
0 1021
8
2
8
0 1434
8
2
8
1 1434
8
0 1082
8
2
8
1 1082
8
0 1814
8
2
8
1 1814
8
0 950
8
2
8
1 950
8
0 99
8
2
8
1 99
8
0 775
8
2
8
1 775
8
0 358
8
2
8
1 358
8
0 1187
8
2
8
1 1187
8
0 1164
8
2
8
1 1164
8
0 1746
8
2
8
1 1746
8
0 773
8
2
8
1 773
8
0 414
8
2
8
1 414
8
0 806
8
2
8...

result:

points 0.46626666670 points  0.46626666670

Test #86:

score: 25
Acceptable Answer
time: 24ms
memory: 3908kb

input:

2000
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
2
2
2...

output:

8
0 1647
8
2
8
0 367
8
2
8
1 367
8
0 1413
8
2
8
0 401
8
2
8
1 401
8
0 967
8
2
8
1 967
8
0 1549
8
2
8
1 1549
8
0 580
8
2
8
1 580
8
0 945
8
2
8
1 945
8
0 1140
8
2
8
1 1140
8
0 1684
8
2
8
1 1684
8
0 835
8
2
8
1 835
8
0 800
8
2
8
1 800
8
0 1540
8
2
8
1 1540
8
0 1664
8
2
8
1 1664
8
0 1148
8
2
8
1 1148
8
...

result:

points 0.33333333330 points  0.33333333330

Test #87:

score: 75
Accepted
time: 17ms
memory: 3960kb

input:

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

output:

8
0 374
8
2
8
0 1635
8
2
8
0 1925
8
2
8
0 966
8
2
8
1 966
8
0 1506
8
2
8
0 96
8
2
8
1 96
8
0 784
8
2
8
1 784
8
0 1641
8
2
8
0 556
8
2
8
1 556
8
0 1153
8
2
8
0 1495
8
2
8
0 45
8
2
8
1 45
8
0 1309
8
2
8
0 903
8
2
8
1 903
8
0 69
8
2
8
1 69
8
0 485
8
2
8
1 485
8
0 443
8
2
8
1 443
8
0 331
8
2
8
1 331
8
0...

result:

ok 

Test #88:

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

input:

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

output:

8
0 374
8
2
8
0 1635
8
2
8
0 1925
8
2
8
1 1925
8
0 966
8
2
8
0 1506
8
2
8
1 1506
8
0 96
8
2
8
0 784
8
2
8
0 1641
8
2
8
1 1641
8
0 556
8
2
8
0 1153
8
2
8
1 1153
8
0 1495
8
2
8
1 1495
8
0 45
8
2
8
0 1309
8
2
8
1 1309
8
0 903
8
2
8
0 69
8
2
8
0 485
8
2
8
0 443
8
2
8
0 331
8
2
8
0 563
8
2
8
0 478
8
2
8
...

result:

ok 

Test #89:

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

input:

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

output:

8
0 374
8
2
8
0 1635
8
2
8
1 1635
8
0 1925
8
2
8
1 1925
8
0 966
8
2
8
0 1506
8
2
8
1 1506
8
0 96
8
2
8
1 96
8
0 784
8
2
8
0 1641
8
2
8
1 1641
8
0 556
8
2
8
0 1153
8
2
8
0 1495
8
2
8
0 45
8
2
8
1 45
8
0 1309
8
2
8
0 903
8
2
8
0 69
8
2
8
1 69
8
0 485
8
2
8
1 485
8
0 443
8
2
8
1 443
8
0 331
8
2
8
1 331...

result:

ok