QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#430079#4565. Rarest Insectsjames1BadCreeper#50.03 39ms4140kbC++171.7kb2024-06-03 13:38:362024-06-03 13:38:38

Judging History

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

  • [2024-06-03 13:38:38]
  • 评测
  • 测评结果:50.03
  • 用时:39ms
  • 内存:4140kb
  • [2024-06-03 13:38:36]
  • 提交

answer

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

// 最多问 3n 次询问
int n, m, k, id[N], always_no[N]; 
vector<int> arr; 
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; 
    vector<int> newarr; 
    for (int i : arr) {
        Move_inside(i); in[i] = 1; 
        if (press_button() > x) {
            Move_outside(i); in[i] = 0; --cnt; newarr.emplace_back(i); 
            // if (cnt < k * x) {
                // for (int i : arr)
                    // if (in[i]) Move_outside(i), in[i] = 0; 
                // return 0; 
            // }
        }
    }
    if (cnt == k * x) {
        arr = newarr; 
        // for (int i : newarr) in[i] = 0; 
        return 1; 
    }
    for (int i : arr)
        if (in[i]) Move_outside(i), in[i] = 0; 
    return 0; 
}
int min_cardinality(int N) {
    n = N; 
    k = n; 
    for (int i = 1; i <= n; ++i) id[i] = i, always_no[i] = 0; 
    shuffle(id + 1, id + n + 1, Rand);  
    for (int i = 1; i <= n; ++i) {
        Move_inside(i); 
        if (press_button() > 1) Move_outside(i), --k, arr.emplace_back(i);  
    }

    // 最罕见的出现次数是 1,当且仅当什么时候?
    int L = 0, R = n / k + 1; // [2, n / k]

    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: 3832kb

input:

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

output:

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

result:

ok 

Test #2:

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

input:

2
1
2
2
2

output:

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

result:

ok 

Test #3:

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

input:

2
1
1

output:

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

result:

ok 

Test #4:

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

input:

3
1
2
1
2

output:

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

result:

ok 

Test #5:

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

input:

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

output:

8
0 3
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 1
8
2
8
1 1
8
0 0
8
2
8
1 0
8
0 4
8
2
8
1 4
8
0 1
8
2
8
1 1
8
0 0
8
2
8
0 4
8
2
8
1 4
8
0 1
8
2
8
3 2

result:

ok 

Test #6:

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

input:

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

output:

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

result:

ok 

Test #7:

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

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 178
8
2
8
0 181
8
2
8
1 181
8
0 112
8
2
8
1 112
8
0 41
8
2
8
1 41
8
0 188
8
2
8
1 188
8
0 166
8
2
8
1 166
8
0 5
8
2
8
1 5
8
0 150
8
2
8
1 150
8
0 121
8
2
8
1 121
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 81
8
2
8
1 81
8
0 13
8
2
8
1 13
8
0 78
8
2
8
1 78
8
0 85
8
2
8
1 85
8
0 9
8
2
8
1 9
8
0 63
8
2...

result:

ok 

Test #8:

score: 0
Accepted
time: 2ms
memory: 3908kb

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 157
8
2
8
0 180
8
2
8
0 59
8
2
8
0 40
8
2
8
0 119
8
2
8
0 54
8
2
8
0 179
8
2
8
0 0
8
2
8
0 141
8
2
8
0 127
8
2
8
0 105
8
2
8
0 195
8
2
8
0 41
8
2
8
0 9
8
2
8
0 84
8
2
8
0 35
8
2
8
0 62
8
2
8
0 45
8
2
8
0 68
8
2
8
0 177
8
2
8
0 76
8
2
8
0 15
8
2
8
0 20
8
2
8
0 161
8
2
8
0 103
8
2
8
0 42
8
2
8
0 1...

result:

ok 

Test #9:

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

input:

200
1
1
1
1
1
1
1
2
2
2
1
1
2
1
1
2
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 157
8
2
8
0 180
8
2
8
0 59
8
2
8
0 40
8
2
8
0 119
8
2
8
0 54
8
2
8
0 179
8
2
8
0 0
8
2
8
1 0
8
0 141
8
2
8
1 141
8
0 127
8
2
8
1 127
8
0 105
8
2
8
0 195
8
2
8
0 41
8
2
8
1 41
8
0 9
8
2
8
0 84
8
2
8
0 35
8
2
8
1 35
8
0 62
8
2
8
1 62
8
0 45
8
2
8
0 68
8
2
8
1 68
8
0 177
8
2
8
1 177
8
0 76
8
2
8
1 ...

result:

ok 

Test #10:

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

input:

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

output:

8
0 157
8
2
8
0 180
8
2
8
0 59
8
2
8
0 40
8
2
8
1 40
8
0 119
8
2
8
0 54
8
2
8
0 179
8
2
8
0 0
8
2
8
1 0
8
0 141
8
2
8
1 141
8
0 127
8
2
8
1 127
8
0 105
8
2
8
0 195
8
2
8
0 41
8
2
8
1 41
8
0 9
8
2
8
0 84
8
2
8
0 35
8
2
8
0 62
8
2
8
1 62
8
0 45
8
2
8
0 68
8
2
8
1 68
8
0 177
8
2
8
1 177
8
0 76
8
2
8
1 ...

result:

ok 

Test #11:

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

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
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 178
8
2
8
0 181
8
2
8
1 181
8
0 112
8
2
8
1 112
8
0 41
8
2
8
1 41
8
0 188
8
2
8
1 188
8
0 166
8
2
8
1 166
8
0 5
8
2
8
1 5
8
0 150
8
2
8
1 150
8
0 121
8
2
8
1 121
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 81
8
2
8
1 81
8
0 13
8
2
8
1 13
8
0 78
8
2
8
1 78
8
0 85
8
2
8
1 85
8
0 9
8
2
8
1 9
8
0 63
8
2...

result:

ok 

Test #12:

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

input:

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

output:

8
0 178
8
2
8
0 181
8
2
8
1 181
8
0 112
8
2
8
1 112
8
0 41
8
2
8
1 41
8
0 188
8
2
8
0 166
8
2
8
1 166
8
0 5
8
2
8
1 5
8
0 150
8
2
8
0 121
8
2
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 81
8
2
8
1 81
8
0 13
8
2
8
0 78
8
2
8
1 78
8
0 85
8
2
8
0 9
8
2
8
1 9
8
0 63
8
2
8
0 26
8
2
8
1 26
8
0 69
8
2
8
1 69
8...

result:

ok 

Test #13:

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

input:

197
1
2
1
2
1
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
2
2
2
2
2
2
2
2
2
2
2
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 178
8
2
8
0 181
8
2
8
1 181
8
0 112
8
2
8
0 41
8
2
8
1 41
8
0 188
8
2
8
0 166
8
2
8
1 166
8
0 5
8
2
8
1 5
8
0 150
8
2
8
1 150
8
0 121
8
2
8
1 121
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 81
8
2
8
1 81
8
0 13
8
2
8
1 13
8
0 78
8
2
8
0 85
8
2
8
1 85
8
0 9
8
2
8
1 9
8
0 63
8
2
8
1 63
8
0 26
8
2
8
1 ...

result:

ok 

Test #14:

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

input:

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

output:

8
0 196
8
2
8
0 181
8
2
8
0 49
8
2
8
0 1
8
2
8
1 1
8
0 59
8
2
8
0 95
8
2
8
0 2
8
2
8
0 119
8
2
8
1 119
8
0 156
8
2
8
0 30
8
2
8
1 30
8
0 84
8
2
8
0 56
8
2
8
0 80
8
2
8
0 97
8
2
8
1 97
8
0 149
8
2
8
1 149
8
0 21
8
2
8
1 21
8
0 41
8
2
8
1 41
8
0 66
8
2
8
1 66
8
0 155
8
2
8
1 155
8
0 40
8
2
8
1 40
8
0 ...

result:

ok 

Test #15:

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

input:

200
1
1
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 196
8
2
8
0 181
8
2
8
0 49
8
2
8
0 1
8
2
8
1 1
8
0 59
8
2
8
0 95
8
2
8
1 95
8
0 2
8
2
8
1 2
8
0 119
8
2
8
1 119
8
0 156
8
2
8
1 156
8
0 30
8
2
8
0 84
8
2
8
1 84
8
0 56
8
2
8
1 56
8
0 80
8
2
8
1 80
8
0 97
8
2
8
1 97
8
0 149
8
2
8
1 149
8
0 21
8
2
8
1 21
8
0 41
8
2
8
1 41
8
0 66
8
2
8
1 66
8
0 155...

result:

ok 

Test #16:

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

input:

196
1
1
1
1
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 124
8
2
8
0 181
8
2
8
0 49
8
2
8
0 1
8
2
8
0 59
8
2
8
0 95
8
2
8
0 2
8
2
8
1 2
8
0 119
8
2
8
1 119
8
0 156
8
2
8
1 156
8
0 30
8
2
8
1 30
8
0 84
8
2
8
1 84
8
0 56
8
2
8
1 56
8
0 80
8
2
8
1 80
8
0 97
8
2
8
1 97
8
0 149
8
2
8
0 21
8
2
8
1 21
8
0 41
8
2
8
1 41
8
0 66
8
2
8
1 66
8
0 155
8
2
8
1 155
8...

result:

ok 

Test #17:

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

input:

199
1
1
1
2
1
2
2
1
2
2
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 197
8
2
8
0 84
8
2
8
0 45
8
2
8
0 106
8
2
8
1 106
8
0 22
8
2
8
0 71
8
2
8
1 71
8
0 10
8
2
8
1 10
8
0 119
8
2
8
0 157
8
2
8
1 157
8
0 28
8
2
8
1 28
8
0 85
8
2
8
0 57
8
2
8
0 81
8
2
8
1 81
8
0 87
8
2
8
1 87
8
0 16
8
2
8
1 16
8
0 120
8
2
8
0 24
8
2
8
1 24
8
0 67
8
2
8
0 131
8
2
8
1 131
8
0 41
8
2
8...

result:

ok 

Test #18:

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

input:

196
1
1
1
1
1
1
2
1
2
2
2
1
2
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
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 124
8
2
8
0 181
8
2
8
0 49
8
2
8
0 1
8
2
8
0 59
8
2
8
0 95
8
2
8
0 2
8
2
8
1 2
8
0 119
8
2
8
0 156
8
2
8
1 156
8
0 30
8
2
8
1 30
8
0 84
8
2
8
1 84
8
0 56
8
2
8
0 80
8
2
8
1 80
8
0 97
8
2
8
1 97
8
0 149
8
2
8
1 149
8
0 21
8
2
8
1 21
8
0 41
8
2
8
1 41
8
0 66
8
2
8
1 66
8
0 155
8
2
8
1 155
8
0 40
8...

result:

ok 

Test #19:

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

input:

196
1
1
1
1
1
1
1
2
1
1
2
2
2
2
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 124
8
2
8
0 181
8
2
8
0 49
8
2
8
0 1
8
2
8
0 59
8
2
8
0 95
8
2
8
0 2
8
2
8
0 119
8
2
8
1 119
8
0 156
8
2
8
0 30
8
2
8
0 84
8
2
8
1 84
8
0 56
8
2
8
1 56
8
0 80
8
2
8
1 80
8
0 97
8
2
8
1 97
8
0 149
8
2
8
1 149
8
0 21
8
2
8
0 41
8
2
8
1 41
8
0 66
8
2
8
1 66
8
0 155
8
2
8
1 155
8
0 40
8
2
8
1 40
8
0...

result:

ok 

Test #20:

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

input:

196
1
1
1
1
2
2
1
1
2
2
1
2
1
2
1
2
2
1
2
2
1
2
2
2
2
2
1
1
2
2
1
2
2
1
1
2
1
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 124
8
2
8
0 181
8
2
8
0 49
8
2
8
0 1
8
2
8
0 59
8
2
8
1 59
8
0 95
8
2
8
1 95
8
0 2
8
2
8
0 119
8
2
8
0 156
8
2
8
1 156
8
0 30
8
2
8
1 30
8
0 84
8
2
8
0 56
8
2
8
1 56
8
0 80
8
2
8
0 97
8
2
8
1 97
8
0 149
8
2
8
0 21
8
2
8
1 21
8
0 41
8
2
8
1 41
8
0 66
8
2
8
0 155
8
2
8
1 155
8
0 40
8
2
8
1 40
8
0 ...

result:

ok 

Test #21:

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

input:

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

output:

8
0 196
8
2
8
0 181
8
2
8
0 49
8
2
8
0 1
8
2
8
0 59
8
2
8
0 95
8
2
8
0 2
8
2
8
0 119
8
2
8
0 156
8
2
8
0 30
8
2
8
1 30
8
0 84
8
2
8
0 56
8
2
8
0 80
8
2
8
0 97
8
2
8
0 149
8
2
8
1 149
8
0 21
8
2
8
0 41
8
2
8
1 41
8
0 66
8
2
8
1 66
8
0 155
8
2
8
1 155
8
0 40
8
2
8
0 161
8
2
8
0 166
8
2
8
0 197
8
2
8
1...

result:

ok 

Test #22:

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

input:

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

output:

8
0 197
8
2
8
0 84
8
2
8
0 45
8
2
8
0 106
8
2
8
0 22
8
2
8
0 71
8
2
8
0 10
8
2
8
0 119
8
2
8
0 157
8
2
8
0 28
8
2
8
1 28
8
0 85
8
2
8
0 57
8
2
8
0 81
8
2
8
0 87
8
2
8
0 16
8
2
8
1 16
8
0 120
8
2
8
0 24
8
2
8
1 24
8
0 67
8
2
8
0 131
8
2
8
0 41
8
2
8
0 130
8
2
8
0 167
8
2
8
0 198
8
2
8
0 59
8
2
8
1 59...

result:

ok 

Test #23:

score: 0
Accepted
time: 2ms
memory: 3912kb

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

output:

8
0 196
8
2
8
0 181
8
2
8
0 49
8
2
8
0 1
8
2
8
0 59
8
2
8
0 95
8
2
8
0 2
8
2
8
0 119
8
2
8
0 156
8
2
8
0 30
8
2
8
0 84
8
2
8
0 56
8
2
8
0 80
8
2
8
0 97
8
2
8
0 149
8
2
8
0 21
8
2
8
0 41
8
2
8
0 66
8
2
8
0 155
8
2
8
0 40
8
2
8
0 161
8
2
8
0 166
8
2
8
0 197
8
2
8
0 141
8
2
8
0 182
8
2
8
0 105
8
2
8
0 ...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

score: 15
Accepted
time: 7ms
memory: 4136kb

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 254
8
2
8
0 673
8
2
8
1 673
8
0 729
8
2
8
1 729
8
0 298
8
2
8
1 298
8
0 359
8
2
8
1 359
8
0 758
8
2
8
1 758
8
0 248
8
2
8
1 248
8
0 119
8
2
8
1 119
8
0 929
8
2
8
1 929
8
0 526
8
2
8
1 526
8
0 866
8
2
8
1 866
8
0 684
8
2
8
1 684
8
0 382
8
2
8
1 382
8
0 97
8
2
8
1 97
8
0 915
8
2
8
1 915
8
0 903
8
...

result:

ok 

Test #25:

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

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 254
8
2
8
0 673
8
2
8
0 729
8
2
8
0 298
8
2
8
0 359
8
2
8
0 758
8
2
8
0 248
8
2
8
0 119
8
2
8
0 929
8
2
8
0 526
8
2
8
0 866
8
2
8
0 684
8
2
8
0 382
8
2
8
0 97
8
2
8
0 915
8
2
8
0 903
8
2
8
0 654
8
2
8
0 482
8
2
8
0 215
8
2
8
0 40
8
2
8
0 598
8
2
8
0 306
8
2
8
0 777
8
2
8
0 141
8
2
8
0 544
8
2
8
...

result:

ok 

Test #26:

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

input:

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

output:

8
0 255
8
2
8
0 84
8
2
8
0 610
8
2
8
0 342
8
2
8
0 22
8
2
8
0 759
8
2
8
0 249
8
2
8
0 844
8
2
8
0 157
8
2
8
0 527
8
2
8
1 527
8
0 867
8
2
8
1 867
8
0 685
8
2
8
1 685
8
0 383
8
2
8
0 542
8
2
8
0 16
8
2
8
1 16
8
0 504
8
2
8
1 504
8
0 655
8
2
8
0 483
8
2
8
0 131
8
2
8
0 41
8
2
8
0 946
8
2
8
0 398
8
2
8...

result:

ok 

Test #27:

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

input:

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

output:

8
0 255
8
2
8
0 84
8
2
8
0 610
8
2
8
0 342
8
2
8
1 342
8
0 22
8
2
8
0 759
8
2
8
1 759
8
0 249
8
2
8
1 249
8
0 844
8
2
8
0 157
8
2
8
0 527
8
2
8
0 867
8
2
8
0 685
8
2
8
0 383
8
2
8
0 542
8
2
8
1 542
8
0 16
8
2
8
0 504
8
2
8
0 655
8
2
8
0 483
8
2
8
0 131
8
2
8
1 131
8
0 41
8
2
8
1 41
8
0 946
8
2
8
0 3...

result:

ok 

Test #28:

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

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 254
8
2
8
0 673
8
2
8
1 673
8
0 729
8
2
8
1 729
8
0 298
8
2
8
1 298
8
0 359
8
2
8
1 359
8
0 758
8
2
8
1 758
8
0 248
8
2
8
1 248
8
0 119
8
2
8
1 119
8
0 929
8
2
8
1 929
8
0 526
8
2
8
1 526
8
0 866
8
2
8
1 866
8
0 684
8
2
8
1 684
8
0 382
8
2
8
1 382
8
0 97
8
2
8
1 97
8
0 915
8
2
8
1 915
8
0 903
8
...

result:

ok 

Test #29:

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

input:

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

output:

8
0 551
8
2
8
0 965
8
2
8
1 965
8
0 278
8
2
8
1 278
8
0 744
8
2
8
1 744
8
0 341
8
2
8
1 341
8
0 705
8
2
8
1 705
8
0 761
8
2
8
1 761
8
0 340
8
2
8
1 340
8
0 101
8
2
8
1 101
8
0 385
8
2
8
1 385
8
0 444
8
2
8
1 444
8
0 664
8
2
8
0 182
8
2
8
0 92
8
2
8
0 215
8
2
8
1 215
8
0 976
8
2
8
1 976
8
0 180
8
2
8...

result:

ok 

Test #30:

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

input:

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

output:

8
0 550
8
2
8
0 964
8
2
8
0 757
8
2
8
0 698
8
2
8
1 698
8
0 719
8
2
8
1 719
8
0 704
8
2
8
0 760
8
2
8
1 760
8
0 76
8
2
8
1 76
8
0 100
8
2
8
1 100
8
0 384
8
2
8
1 384
8
0 194
8
2
8
1 194
8
0 117
8
2
8
1 117
8
0 555
8
2
8
1 555
8
0 347
8
2
8
1 347
8
0 214
8
2
8
1 214
8
0 913
8
2
8
1 913
8
0 615
8
2
8
...

result:

ok 

Test #31:

score: 0
Accepted
time: 14ms
memory: 3928kb

input:

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

output:

8
0 550
8
2
8
0 964
8
2
8
0 757
8
2
8
0 698
8
2
8
0 719
8
2
8
0 704
8
2
8
0 760
8
2
8
0 76
8
2
8
1 76
8
0 100
8
2
8
0 384
8
2
8
1 384
8
0 194
8
2
8
0 117
8
2
8
0 555
8
2
8
1 555
8
0 347
8
2
8
0 214
8
2
8
1 214
8
0 913
8
2
8
0 615
8
2
8
0 576
8
2
8
0 975
8
2
8
1 975
8
0 921
8
2
8
1 921
8
0 35
8
2
8
1...

result:

ok 

Test #32:

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

input:

1000
1
1
2
1
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 550
8
2
8
0 964
8
2
8
0 757
8
2
8
1 757
8
0 698
8
2
8
0 719
8
2
8
1 719
8
0 704
8
2
8
1 704
8
0 760
8
2
8
1 760
8
0 76
8
2
8
1 76
8
0 100
8
2
8
0 384
8
2
8
1 384
8
0 194
8
2
8
1 194
8
0 117
8
2
8
1 117
8
0 555
8
2
8
1 555
8
0 347
8
2
8
1 347
8
0 214
8
2
8
1 214
8
0 913
8
2
8
1 913
8
0 615
8
2
8
...

result:

ok 

Test #33:

score: 0
Accepted
time: 2ms
memory: 3908kb

input:

996
1
1
1
1
2
1
1
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 550
8
2
8
0 964
8
2
8
0 757
8
2
8
0 698
8
2
8
0 719
8
2
8
1 719
8
0 704
8
2
8
0 760
8
2
8
0 76
8
2
8
1 76
8
0 100
8
2
8
0 384
8
2
8
1 384
8
0 194
8
2
8
1 194
8
0 117
8
2
8
0 555
8
2
8
1 555
8
0 347
8
2
8
1 347
8
0 214
8
2
8
1 214
8
0 913
8
2
8
1 913
8
0 615
8
2
8
1 615
8
0 576
8
2
8
1 576
8
0 97...

result:

ok 

Test #34:

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

input:

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

output:

8
0 550
8
2
8
0 964
8
2
8
0 757
8
2
8
1 757
8
0 698
8
2
8
0 719
8
2
8
1 719
8
0 704
8
2
8
0 760
8
2
8
0 76
8
2
8
1 76
8
0 100
8
2
8
1 100
8
0 384
8
2
8
1 384
8
0 194
8
2
8
0 117
8
2
8
0 555
8
2
8
0 347
8
2
8
1 347
8
0 214
8
2
8
1 214
8
0 913
8
2
8
1 913
8
0 615
8
2
8
1 615
8
0 576
8
2
8
1 576
8
0 97...

result:

ok 

Test #35:

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

input:

1000
1
1
1
1
1
2
1
1
2
2
2
2
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 550
8
2
8
0 964
8
2
8
0 757
8
2
8
0 698
8
2
8
0 719
8
2
8
0 704
8
2
8
1 704
8
0 760
8
2
8
0 76
8
2
8
0 100
8
2
8
1 100
8
0 384
8
2
8
1 384
8
0 194
8
2
8
1 194
8
0 117
8
2
8
1 117
8
0 555
8
2
8
0 347
8
2
8
0 214
8
2
8
1 214
8
0 913
8
2
8
1 913
8
0 615
8
2
8
1 615
8
0 576
8
2
8
1 576
8
0 975
8
2
8...

result:

ok 

Test #36:

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

input:

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

output:

8
0 190
8
2
8
0 922
8
2
8
0 958
8
2
8
0 808
8
2
8
1 808
8
0 13
8
2
8
0 444
8
2
8
0 259
8
2
8
1 259
8
0 318
8
2
8
1 318
8
0 586
8
2
8
0 869
8
2
8
1 869
8
0 36
8
2
8
0 968
8
2
8
1 968
8
0 780
8
2
8
1 780
8
0 602
8
2
8
0 25
8
2
8
1 25
8
0 552
8
2
8
1 552
8
0 813
8
2
8
1 813
8
0 537
8
2
8
0 722
8
2
8
0 ...

result:

ok 

Test #37:

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

input:

995
1
1
1
1
1
1
1
2
2
2
1
1
1
1
2
1
2
2
1
1
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
1
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 190
8
2
8
0 922
8
2
8
0 958
8
2
8
0 808
8
2
8
0 13
8
2
8
0 444
8
2
8
0 259
8
2
8
0 318
8
2
8
1 318
8
0 586
8
2
8
1 586
8
0 869
8
2
8
1 869
8
0 36
8
2
8
0 968
8
2
8
0 780
8
2
8
0 602
8
2
8
0 25
8
2
8
1 25
8
0 552
8
2
8
0 813
8
2
8
1 813
8
0 537
8
2
8
1 537
8
0 722
8
2
8
0 611
8
2
8
0 122
8
2
8
0 ...

result:

ok 

Test #38:

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

input:

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

output:

8
0 190
8
2
8
0 922
8
2
8
0 958
8
2
8
0 808
8
2
8
0 13
8
2
8
0 444
8
2
8
1 444
8
0 259
8
2
8
0 318
8
2
8
0 586
8
2
8
0 869
8
2
8
0 36
8
2
8
0 968
8
2
8
0 780
8
2
8
0 602
8
2
8
1 602
8
0 25
8
2
8
0 552
8
2
8
0 813
8
2
8
0 537
8
2
8
0 722
8
2
8
1 722
8
0 611
8
2
8
0 122
8
2
8
1 122
8
0 833
8
2
8
0 197...

result:

ok 

Test #39:

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

input:

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

output:

8
0 190
8
2
8
0 922
8
2
8
0 958
8
2
8
0 808
8
2
8
0 13
8
2
8
0 444
8
2
8
0 259
8
2
8
0 318
8
2
8
1 318
8
0 586
8
2
8
0 869
8
2
8
0 36
8
2
8
0 968
8
2
8
0 780
8
2
8
0 602
8
2
8
0 25
8
2
8
0 552
8
2
8
0 813
8
2
8
0 537
8
2
8
0 722
8
2
8
0 611
8
2
8
0 122
8
2
8
0 833
8
2
8
0 197
8
2
8
1 197
8
0 249
8
2...

result:

ok 

Test #40:

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

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

output:

8
0 621
8
2
8
0 726
8
2
8
0 723
8
2
8
0 667
8
2
8
0 365
8
2
8
0 325
8
2
8
0 258
8
2
8
0 266
8
2
8
0 269
8
2
8
0 868
8
2
8
0 479
8
2
8
0 576
8
2
8
0 66
8
2
8
0 263
8
2
8
0 361
8
2
8
0 951
8
2
8
0 812
8
2
8
0 536
8
2
8
0 813
8
2
8
0 610
8
2
8
0 427
8
2
8
0 832
8
2
8
0 196
8
2
8
0 685
8
2
8
0 102
8
2
8...

result:

ok 

Test #41:

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

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

output:

8
0 190
8
2
8
0 922
8
2
8
0 958
8
2
8
0 808
8
2
8
0 13
8
2
8
0 444
8
2
8
0 259
8
2
8
0 318
8
2
8
0 586
8
2
8
0 869
8
2
8
0 36
8
2
8
0 968
8
2
8
0 780
8
2
8
0 602
8
2
8
0 25
8
2
8
0 552
8
2
8
0 813
8
2
8
0 537
8
2
8
0 722
8
2
8
0 611
8
2
8
0 122
8
2
8
0 833
8
2
8
0 197
8
2
8
0 249
8
2
8
0 78
8
2
8
0 ...

result:

ok 

Test #42:

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

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

output:

8
0 190
8
2
8
0 922
8
2
8
0 958
8
2
8
0 808
8
2
8
0 13
8
2
8
0 444
8
2
8
0 259
8
2
8
0 318
8
2
8
0 586
8
2
8
0 869
8
2
8
0 36
8
2
8
0 968
8
2
8
0 780
8
2
8
0 602
8
2
8
0 25
8
2
8
0 552
8
2
8
0 813
8
2
8
0 537
8
2
8
0 722
8
2
8
0 611
8
2
8
0 122
8
2
8
0 833
8
2
8
0 197
8
2
8
0 249
8
2
8
0 78
8
2
8
0 ...

result:

ok 

Subtask #3:

score: 25.03
Acceptable Answer

Test #43:

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

input:

2
1
2
2
2

output:

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

result:

ok 

Test #44:

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

input:

2
1
1

output:

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

result:

ok 

Test #45:

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

input:

3
1
1
2
2

output:

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

result:

ok 

Test #46:

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

input:

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

output:

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

result:

ok 

Test #47:

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

input:

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

output:

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

result:

ok 

Test #48:

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

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 621
8
2
8
0 1351
8
2
8
1 1351
8
0 723
8
2
8
1 723
8
0 1968
8
2
8
1 1968
8
0 1971
8
2
8
1 1971
8
0 1713
8
2
8
1 1713
8
0 1923
8
2
8
1 1923
8
0 1348
8
2
8
1 1348
8
0 1447
8
2
8
1 1447
8
0 868
8
2
8
1 868
8
0 1598
8
2
8
1 1598
8
0 576
8
2
8
1 576
8
0 1010
8
2
8
1 1010
8
0 263
8
2
8
1 263
8
0 1878
8...

result:

ok 

Test #49:

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

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 375
8
2
8
0 527
8
2
8
0 363
8
2
8
0 1507
8
2
8
0 79
8
2
8
0 618
8
2
8
0 1360
8
2
8
0 1572
8
2
8
0 1078
8
2
8
0 1793
8
2
8
0 1774
8
2
8
0 1739
8
2
8
0 108
8
2
8
0 248
8
2
8
0 1917
8
2
8
0 1273
8
2
8
0 1385
8
2
8
0 909
8
2
8
0 258
8
2
8
0 237
8
2
8
0 860
8
2
8
0 1504
8
2
8
0 1464
8
2
8
0 1522
8
2
...

result:

ok 

Test #50:

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

input:

2000
1
1
1
1
1
1
1
2
1
1
2
2
1
1
1
2
1
1
1
2
2
1
1
2
1
2
2
2
1
1
1
2
2
1
1
2
2
2
2
2
1
2
2
2
2
2
1
2
2
2
2
1
1
2
2
2
2
1
2
2
2
1
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
1
1
2
2
1
2
1
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
1
2
2
2
2
1
1
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 375
8
2
8
0 527
8
2
8
0 363
8
2
8
0 1507
8
2
8
0 79
8
2
8
0 618
8
2
8
0 1360
8
2
8
0 1572
8
2
8
1 1572
8
0 1078
8
2
8
0 1793
8
2
8
0 1774
8
2
8
1 1774
8
0 1739
8
2
8
1 1739
8
0 108
8
2
8
0 248
8
2
8
0 1917
8
2
8
0 1273
8
2
8
1 1273
8
0 1385
8
2
8
0 909
8
2
8
0 258
8
2
8
0 237
8
2
8
1 237
8
0 860...

result:

ok 

Test #51:

score: 70.58
Acceptable Answer
time: 8ms
memory: 3932kb

input:

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

output:

8
0 375
8
2
8
0 527
8
2
8
0 363
8
2
8
0 1507
8
2
8
0 79
8
2
8
0 618
8
2
8
0 1360
8
2
8
0 1572
8
2
8
0 1078
8
2
8
1 1078
8
0 1793
8
2
8
0 1774
8
2
8
0 1739
8
2
8
1 1739
8
0 108
8
2
8
0 248
8
2
8
0 1917
8
2
8
0 1273
8
2
8
0 1385
8
2
8
1 1385
8
0 909
8
2
8
0 258
8
2
8
0 237
8
2
8
1 237
8
0 860
8
2
8
0 ...

result:

points 0.94106666670 points  0.94106666670

Test #52:

score: 25.03
Acceptable Answer
time: 37ms
memory: 3872kb

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 375
8
2
8
0 527
8
2
8
1 527
8
0 363
8
2
8
1 363
8
0 1507
8
2
8
1 1507
8
0 79
8
2
8
1 79
8
0 618
8
2
8
1 618
8
0 1360
8
2
8
1 1360
8
0 1572
8
2
8
1 1572
8
0 1078
8
2
8
1 1078
8
0 1793
8
2
8
1 1793
8
0 1774
8
2
8
1 1774
8
0 1739
8
2
8
1 1739
8
0 108
8
2
8
1 108
8
0 248
8
2
8
1 248
8
0 1917
8
2
8
1...

result:

points 0.33373333330 points  0.33373333330

Test #53:

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

input:

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

output:

8
0 767
8
2
8
0 1831
8
2
8
1 1831
8
0 583
8
2
8
0 1428
8
2
8
0 329
8
2
8
0 1976
8
2
8
0 1315
8
2
8
0 173
8
2
8
0 1123
8
2
8
0 384
8
2
8
0 78
8
2
8
0 970
8
2
8
1 970
8
0 1341
8
2
8
0 1444
8
2
8
1 1444
8
0 52
8
2
8
1 52
8
0 1087
8
2
8
1 1087
8
0 453
8
2
8
0 927
8
2
8
1 927
8
0 1944
8
2
8
0 996
8
2
8
1...

result:

ok 

Test #54:

score: 28.2
Acceptable Answer
time: 39ms
memory: 3872kb

input:

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

output:

8
0 767
8
2
8
0 1831
8
2
8
0 583
8
2
8
0 1428
8
2
8
1 1428
8
0 329
8
2
8
1 329
8
0 1976
8
2
8
0 1315
8
2
8
1 1315
8
0 173
8
2
8
1 173
8
0 1123
8
2
8
1 1123
8
0 384
8
2
8
1 384
8
0 78
8
2
8
1 78
8
0 970
8
2
8
1 970
8
0 1341
8
2
8
1 1341
8
0 1444
8
2
8
1 1444
8
0 52
8
2
8
1 52
8
0 1087
8
2
8
1 1087
8
...

result:

points 0.3760 points  0.3760

Test #55:

score: 57.87
Acceptable Answer
time: 16ms
memory: 3920kb

input:

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

output:

8
0 684
8
2
8
0 1669
8
2
8
0 1785
8
2
8
0 1621
8
2
8
0 717
8
2
8
0 30
8
2
8
0 468
8
2
8
0 1897
8
2
8
0 1915
8
2
8
0 520
8
2
8
0 467
8
2
8
0 1966
8
2
8
1 1966
8
0 176
8
2
8
0 1189
8
2
8
0 1269
8
2
8
1 1269
8
0 823
8
2
8
1 823
8
0 455
8
2
8
0 1473
8
2
8
0 59
8
2
8
1 59
8
0 51
8
2
8
0 1043
8
2
8
1 1043...

result:

points 0.77160 points  0.77160

Test #56:

score: 74.56
Acceptable Answer
time: 10ms
memory: 3848kb

input:

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

output:

8
0 684
8
2
8
0 1669
8
2
8
1 1669
8
0 1785
8
2
8
1 1785
8
0 1621
8
2
8
0 717
8
2
8
0 30
8
2
8
0 468
8
2
8
1 468
8
0 1897
8
2
8
1 1897
8
0 1915
8
2
8
0 520
8
2
8
1 520
8
0 467
8
2
8
1 467
8
0 1966
8
2
8
1 1966
8
0 176
8
2
8
1 176
8
0 1189
8
2
8
1 1189
8
0 1269
8
2
8
1 1269
8
0 823
8
2
8
1 823
8
0 455...

result:

points 0.99413333330 points  0.99413333330

Test #57:

score: 74.51
Acceptable Answer
time: 12ms
memory: 3848kb

input:

1999
1
1
1
2
2
1
2
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 685
8
2
8
0 1776
8
2
8
0 116
8
2
8
0 1652
8
2
8
1 1652
8
0 127
8
2
8
1 127
8
0 274
8
2
8
0 469
8
2
8
1 469
8
0 1870
8
2
8
1 1870
8
0 1668
8
2
8
0 1694
8
2
8
1 1694
8
0 1734
8
2
8
1 1734
8
0 1967
8
2
8
1 1967
8
0 1338
8
2
8
0 41
8
2
8
1 41
8
0 336
8
2
8
1 336
8
0 294
8
2
8
1 294
8
0 276
8
2
8
1 2...

result:

points 0.99346666670 points  0.99346666670

Test #58:

score: 73.62
Acceptable Answer
time: 7ms
memory: 3864kb

input:

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

output:

8
0 810
8
2
8
0 1077
8
2
8
0 800
8
2
8
1 800
8
0 1026
8
2
8
0 1810
8
2
8
0 373
8
2
8
0 1070
8
2
8
1 1070
8
0 1336
8
2
8
1 1336
8
0 1486
8
2
8
1 1486
8
0 722
8
2
8
1 722
8
0 1461
8
2
8
1 1461
8
0 1549
8
2
8
1 1549
8
0 675
8
2
8
0 364
8
2
8
1 364
8
0 1920
8
2
8
0 597
8
2
8
1 597
8
0 386
8
2
8
1 386
8
...

result:

points 0.98160 points  0.98160

Test #59:

score: 72.83
Acceptable Answer
time: 20ms
memory: 3856kb

input:

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

output:

8
0 715
8
2
8
0 1076
8
2
8
1 1076
8
0 1275
8
2
8
0 530
8
2
8
0 1829
8
2
8
0 372
8
2
8
1 372
8
0 1367
8
2
8
0 1159
8
2
8
0 1276
8
2
8
0 293
8
2
8
1 293
8
0 1460
8
2
8
1 1460
8
0 1548
8
2
8
1 1548
8
0 1965
8
2
8
1 1965
8
0 332
8
2
8
1 332
8
0 69
8
2
8
1 69
8
0 1773
8
2
8
0 1019
8
2
8
1 1019
8
0 375
8
...

result:

points 0.97106666670 points  0.97106666670

Test #60:

score: 72.3
Acceptable Answer
time: 5ms
memory: 4132kb

input:

1996
1
1
2
1
1
1
2
1
2
2
1
1
1
2
1
2
1
2
1
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
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 715
8
2
8
0 1076
8
2
8
0 1275
8
2
8
1 1275
8
0 530
8
2
8
0 1829
8
2
8
0 372
8
2
8
0 1367
8
2
8
1 1367
8
0 1159
8
2
8
0 1276
8
2
8
1 1276
8
0 293
8
2
8
1 293
8
0 1460
8
2
8
0 1548
8
2
8
0 1965
8
2
8
0 332
8
2
8
1 332
8
0 69
8
2
8
0 1773
8
2
8
1 1773
8
0 1019
8
2
8
0 375
8
2
8
1 375
8
0 822
8
2
8
...

result:

points 0.9640 points  0.9640

Test #61:

score: 72.83
Acceptable Answer
time: 18ms
memory: 3860kb

input:

2000
1
1
1
2
1
1
1
1
2
2
2
1
1
2
2
2
2
1
2
1
2
2
1
2
2
1
2
2
2
1
1
2
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
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 715
8
2
8
0 1076
8
2
8
0 1275
8
2
8
0 530
8
2
8
1 530
8
0 1829
8
2
8
0 372
8
2
8
0 1367
8
2
8
0 1159
8
2
8
0 1276
8
2
8
1 1276
8
0 293
8
2
8
1 293
8
0 1460
8
2
8
1 1460
8
0 1548
8
2
8
0 1965
8
2
8
0 332
8
2
8
1 332
8
0 69
8
2
8
1 69
8
0 1773
8
2
8
1 1773
8
0 1019
8
2
8
1 1019
8
0 375
8
2
8
0 822...

result:

points 0.97106666670 points  0.97106666670

Test #62:

score: 70.74
Acceptable Answer
time: 14ms
memory: 3848kb

input:

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

output:

8
0 0
8
2
8
0 1104
8
2
8
0 786
8
2
8
0 1205
8
2
8
0 574
8
2
8
0 849
8
2
8
0 957
8
2
8
0 889
8
2
8
0 379
8
2
8
0 1762
8
2
8
0 821
8
2
8
0 387
8
2
8
0 1152
8
2
8
0 1230
8
2
8
0 1185
8
2
8
1 1185
8
0 114
8
2
8
0 555
8
2
8
0 267
8
2
8
0 985
8
2
8
1 985
8
0 1614
8
2
8
1 1614
8
0 1684
8
2
8
1 1684
8
0 678...

result:

points 0.94320 points  0.94320

Test #63:

score: 73.07
Acceptable Answer
time: 10ms
memory: 3860kb

input:

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

output:

8
0 0
8
2
8
0 1104
8
2
8
0 786
8
2
8
0 1205
8
2
8
0 574
8
2
8
0 849
8
2
8
0 957
8
2
8
0 889
8
2
8
0 379
8
2
8
0 1762
8
2
8
0 821
8
2
8
0 387
8
2
8
1 387
8
0 1152
8
2
8
0 1230
8
2
8
0 1185
8
2
8
0 114
8
2
8
0 555
8
2
8
1 555
8
0 267
8
2
8
0 985
8
2
8
0 1614
8
2
8
0 1684
8
2
8
0 678
8
2
8
1 678
8
0 37...

result:

points 0.97426666670 points  0.97426666670

Test #64:

score: 71.88
Acceptable Answer
time: 0ms
memory: 4104kb

input:

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

output:

8
0 520
8
2
8
0 1105
8
2
8
0 787
8
2
8
0 1035
8
2
8
0 1492
8
2
8
0 209
8
2
8
0 143
8
2
8
0 815
8
2
8
0 1160
8
2
8
0 1763
8
2
8
0 802
8
2
8
0 830
8
2
8
0 1153
8
2
8
0 1231
8
2
8
0 1402
8
2
8
0 1690
8
2
8
0 1182
8
2
8
0 1318
8
2
8
0 691
8
2
8
0 1615
8
2
8
0 1685
8
2
8
0 740
8
2
8
1 740
8
0 294
8
2
8
0...

result:

points 0.95840 points  0.95840

Test #65:

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

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

output:

8
0 520
8
2
8
0 1105
8
2
8
0 787
8
2
8
0 1035
8
2
8
0 1492
8
2
8
0 209
8
2
8
0 143
8
2
8
0 815
8
2
8
0 1160
8
2
8
0 1763
8
2
8
0 802
8
2
8
0 830
8
2
8
0 1153
8
2
8
0 1231
8
2
8
0 1402
8
2
8
0 1690
8
2
8
0 1182
8
2
8
0 1318
8
2
8
0 691
8
2
8
0 1615
8
2
8
0 1685
8
2
8
0 740
8
2
8
0 294
8
2
8
0 905
8
2...

result:

ok 

Test #66:

score: 75
Accepted
time: 9ms
memory: 4132kb

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

output:

8
0 0
8
2
8
0 1104
8
2
8
0 786
8
2
8
0 1205
8
2
8
0 574
8
2
8
0 849
8
2
8
0 957
8
2
8
0 889
8
2
8
0 379
8
2
8
0 1762
8
2
8
0 821
8
2
8
0 387
8
2
8
0 1152
8
2
8
0 1230
8
2
8
0 1185
8
2
8
0 114
8
2
8
0 555
8
2
8
0 267
8
2
8
0 985
8
2
8
0 1614
8
2
8
0 1684
8
2
8
0 678
8
2
8
0 370
8
2
8
0 904
8
2
8
0 11...

result:

ok 

Test #67:

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

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

output:

8
0 1179
8
2
8
0 575
8
2
8
0 1403
8
2
8
0 1749
8
2
8
0 1182
8
2
8
0 1793
8
2
8
0 159
8
2
8
0 1491
8
2
8
0 645
8
2
8
0 57
8
2
8
0 205
8
2
8
0 570
8
2
8
0 612
8
2
8
0 777
8
2
8
0 1981
8
2
8
0 491
8
2
8
0 1575
8
2
8
0 441
8
2
8
0 778
8
2
8
0 798
8
2
8
0 1130
8
2
8
0 1649
8
2
8
0 536
8
2
8
0 351
8
2
8
0...

result:

ok 

Test #68:

score: 74.76
Acceptable Answer
time: 17ms
memory: 3844kb

input:

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

output:

8
0 1179
8
2
8
0 575
8
2
8
0 1403
8
2
8
0 1749
8
2
8
0 1182
8
2
8
0 1793
8
2
8
0 159
8
2
8
0 1491
8
2
8
0 645
8
2
8
0 57
8
2
8
0 205
8
2
8
0 570
8
2
8
0 612
8
2
8
0 777
8
2
8
0 981
8
2
8
0 491
8
2
8
0 1575
8
2
8
1 1575
8
0 441
8
2
8
1 441
8
0 778
8
2
8
0 798
8
2
8
0 1130
8
2
8
0 1649
8
2
8
0 536
8
2...

result:

points 0.99680 points  0.99680

Test #69:

score: 74.76
Acceptable Answer
time: 0ms
memory: 3920kb

input:

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

output:

8
0 1179
8
2
8
0 575
8
2
8
0 1403
8
2
8
0 1749
8
2
8
0 1182
8
2
8
0 1793
8
2
8
0 159
8
2
8
0 1491
8
2
8
0 645
8
2
8
0 57
8
2
8
0 205
8
2
8
0 570
8
2
8
0 612
8
2
8
0 777
8
2
8
0 981
8
2
8
0 491
8
2
8
0 1575
8
2
8
1 1575
8
0 441
8
2
8
1 441
8
0 778
8
2
8
0 798
8
2
8
0 1130
8
2
8
0 1649
8
2
8
0 536
8
2...

result:

points 0.99680 points  0.99680

Test #70:

score: 74.89
Acceptable Answer
time: 13ms
memory: 3848kb

input:

1979
1
1
1
1
1
2
1
1
1
1
1
2
1
1
2
1
2
1
2
1
2
1
2
2
1
1
2
2
2
2
2
2
1
1
2
2
1
1
2
2
2
2
1
2
2
1
2
2
2
2
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
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
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 1179
8
2
8
0 575
8
2
8
0 1403
8
2
8
0 1749
8
2
8
0 1182
8
2
8
0 1793
8
2
8
1 1793
8
0 159
8
2
8
0 1491
8
2
8
0 645
8
2
8
0 57
8
2
8
0 205
8
2
8
0 570
8
2
8
1 570
8
0 612
8
2
8
0 777
8
2
8
0 981
8
2
8
1 981
8
0 491
8
2
8
0 1575
8
2
8
1 1575
8
0 441
8
2
8
0 778
8
2
8
1 778
8
0 798
8
2
8
0 1130
8
2...

result:

points 0.99853333330 points  0.99853333330

Test #71:

score: 74.89
Acceptable Answer
time: 5ms
memory: 4128kb

input:

1979
1
1
1
1
1
2
1
1
1
1
1
2
1
1
2
1
2
1
2
1
2
1
2
2
1
1
2
2
2
2
2
2
1
1
2
2
1
1
2
2
2
2
1
2
2
1
2
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
2
1
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
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 1179
8
2
8
0 575
8
2
8
0 1403
8
2
8
0 1749
8
2
8
0 1182
8
2
8
0 1793
8
2
8
1 1793
8
0 159
8
2
8
0 1491
8
2
8
0 645
8
2
8
0 57
8
2
8
0 205
8
2
8
0 570
8
2
8
1 570
8
0 612
8
2
8
0 777
8
2
8
0 981
8
2
8
1 981
8
0 491
8
2
8
0 1575
8
2
8
1 1575
8
0 441
8
2
8
0 778
8
2
8
1 778
8
0 798
8
2
8
0 1130
8
2...

result:

points 0.99853333330 points  0.99853333330

Test #72:

score: 70.81
Acceptable Answer
time: 11ms
memory: 3852kb

input:

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

output:

8
0 196
8
2
8
0 450
8
2
8
0 362
8
2
8
0 1460
8
2
8
0 1870
8
2
8
0 1192
8
2
8
0 882
8
2
8
0 1458
8
2
8
0 1751
8
2
8
0 340
8
2
8
0 967
8
2
8
0 1365
8
2
8
1 1365
8
0 1914
8
2
8
0 466
8
2
8
0 1641
8
2
8
0 1877
8
2
8
1 1877
8
0 1624
8
2
8
0 614
8
2
8
0 469
8
2
8
1 469
8
0 621
8
2
8
1 621
8
0 692
8
2
8
0 ...

result:

points 0.94413333330 points  0.94413333330

Test #73:

score: 70.81
Acceptable Answer
time: 23ms
memory: 3808kb

input:

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

output:

8
0 196
8
2
8
0 450
8
2
8
0 362
8
2
8
0 1460
8
2
8
0 1870
8
2
8
0 1192
8
2
8
0 882
8
2
8
0 1458
8
2
8
0 1751
8
2
8
0 340
8
2
8
0 967
8
2
8
1 967
8
0 1365
8
2
8
0 1914
8
2
8
0 466
8
2
8
0 1641
8
2
8
0 1877
8
2
8
0 1624
8
2
8
0 614
8
2
8
0 469
8
2
8
1 469
8
0 621
8
2
8
0 692
8
2
8
1 692
8
0 1887
8
2
8...

result:

points 0.94413333330 points  0.94413333330

Test #74:

score: 66.24
Acceptable Answer
time: 0ms
memory: 3868kb

input:

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

output:

8
0 196
8
2
8
0 450
8
2
8
0 362
8
2
8
0 1460
8
2
8
0 1870
8
2
8
1 1870
8
0 1192
8
2
8
0 882
8
2
8
0 1458
8
2
8
0 1751
8
2
8
0 340
8
2
8
0 967
8
2
8
0 1365
8
2
8
0 1914
8
2
8
0 466
8
2
8
0 1641
8
2
8
0 1877
8
2
8
0 1624
8
2
8
0 614
8
2
8
0 469
8
2
8
0 621
8
2
8
0 692
8
2
8
0 1887
8
2
8
0 1977
8
2
8
1...

result:

points 0.88320 points  0.88320

Test #75:

score: 66.24
Acceptable Answer
time: 14ms
memory: 3928kb

input:

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

output:

8
0 88
8
2
8
0 1154
8
2
8
0 104
8
2
8
0 1158
8
2
8
0 262
8
2
8
0 1477
8
2
8
0 435
8
2
8
0 870
8
2
8
0 1058
8
2
8
0 615
8
2
8
0 1667
8
2
8
0 1508
8
2
8
0 406
8
2
8
1 406
8
0 926
8
2
8
1 926
8
0 1272
8
2
8
0 1505
8
2
8
0 1451
8
2
8
0 1526
8
2
8
0 1756
8
2
8
0 174
8
2
8
1 174
8
0 1966
8
2
8
1 1966
8
0 ...

result:

points 0.88320 points  0.88320

Test #76:

score: 74.9
Acceptable Answer
time: 2ms
memory: 3856kb

input:

1970
1
1
1
1
1
1
1
1
1
1
2
2
1
1
1
1
1
2
2
1
1
1
2
1
1
1
1
2
2
2
1
1
2
2
2
2
1
1
2
2
2
2
1
1
1
1
1
2
2
2
2
2
2
1
2
1
1
2
2
2
1
2
2
2
2
1
2
2
1
2
2
2
1
1
1
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
1
2
2
1
2
2
1
2
2
2
2
1
2
2
2
2
1
2
1
2
1
2
2
2
2
2
2
2
2
2
1
2
1
1
2
2
2
1
2
2
1
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2...

output:

8
0 119
8
2
8
0 127
8
2
8
0 483
8
2
8
0 252
8
2
8
0 17
8
2
8
0 1476
8
2
8
0 434
8
2
8
0 1501
8
2
8
0 1593
8
2
8
0 614
8
2
8
0 1666
8
2
8
1 1666
8
0 654
8
2
8
1 654
8
0 1055
8
2
8
0 249
8
2
8
0 905
8
2
8
0 1504
8
2
8
0 1450
8
2
8
0 1631
8
2
8
1 1631
8
0 991
8
2
8
1 991
8
0 6
8
2
8
0 1770
8
2
8
0 31
8...

result:

points 0.99866666670 points  0.99866666670

Test #77:

score: 74.9
Acceptable Answer
time: 5ms
memory: 3852kb

input:

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

output:

8
0 119
8
2
8
0 127
8
2
8
0 483
8
2
8
0 252
8
2
8
0 17
8
2
8
0 1476
8
2
8
0 434
8
2
8
0 1501
8
2
8
0 1593
8
2
8
1 1593
8
0 614
8
2
8
0 1666
8
2
8
1 1666
8
0 654
8
2
8
0 1055
8
2
8
0 249
8
2
8
0 905
8
2
8
0 1504
8
2
8
0 1450
8
2
8
1 1450
8
0 1631
8
2
8
0 991
8
2
8
0 6
8
2
8
0 1770
8
2
8
0 31
8
2
8
1 ...

result:

points 0.99866666670 points  0.99866666670

Test #78:

score: 70.81
Acceptable Answer
time: 10ms
memory: 3804kb

input:

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

output:

8
0 119
8
2
8
0 127
8
2
8
0 483
8
2
8
0 252
8
2
8
0 17
8
2
8
0 1476
8
2
8
1 1476
8
0 434
8
2
8
0 1501
8
2
8
0 1593
8
2
8
0 614
8
2
8
0 1666
8
2
8
0 654
8
2
8
0 1055
8
2
8
0 249
8
2
8
0 905
8
2
8
0 1504
8
2
8
0 1450
8
2
8
0 1631
8
2
8
0 991
8
2
8
0 6
8
2
8
0 1770
8
2
8
1 1770
8
0 31
8
2
8
0 937
8
2
8...

result:

points 0.94413333330 points  0.94413333330

Test #79:

score: 70.81
Acceptable Answer
time: 0ms
memory: 4096kb

input:

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

output:

8
0 1737
8
2
8
0 61
8
2
8
0 538
8
2
8
0 1011
8
2
8
0 1566
8
2
8
0 997
8
2
8
0 644
8
2
8
0 1450
8
2
8
0 855
8
2
8
0 990
8
2
8
0 1586
8
2
8
0 1979
8
2
8
0 1261
8
2
8
0 704
8
2
8
0 1671
8
2
8
0 1018
8
2
8
0 979
8
2
8
0 1424
8
2
8
1 1424
8
0 575
8
2
8
0 379
8
2
8
0 658
8
2
8
0 1596
8
2
8
0 375
8
2
8
0 6...

result:

points 0.94413333330 points  0.94413333330

Test #80:

score: 74.8
Acceptable Answer
time: 4ms
memory: 4104kb

input:

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

output:

8
0 1737
8
2
8
0 61
8
2
8
0 538
8
2
8
0 1011
8
2
8
0 1566
8
2
8
0 997
8
2
8
1 997
8
0 644
8
2
8
0 1450
8
2
8
0 855
8
2
8
0 990
8
2
8
0 1586
8
2
8
0 1989
8
2
8
0 1261
8
2
8
0 704
8
2
8
0 1671
8
2
8
0 1018
8
2
8
0 979
8
2
8
0 1424
8
2
8
0 575
8
2
8
0 379
8
2
8
0 658
8
2
8
0 1596
8
2
8
1 1596
8
0 375
8...

result:

points 0.99733333330 points  0.99733333330

Test #81:

score: 74.8
Acceptable Answer
time: 13ms
memory: 3872kb

input:

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

output:

8
0 1737
8
2
8
0 61
8
2
8
0 538
8
2
8
0 1011
8
2
8
0 1566
8
2
8
0 997
8
2
8
1 997
8
0 644
8
2
8
0 1450
8
2
8
0 855
8
2
8
0 990
8
2
8
0 1586
8
2
8
0 1989
8
2
8
0 1261
8
2
8
0 704
8
2
8
0 1671
8
2
8
0 1018
8
2
8
0 979
8
2
8
0 1424
8
2
8
0 575
8
2
8
0 379
8
2
8
0 658
8
2
8
0 1596
8
2
8
1 1596
8
0 375
8...

result:

points 0.99733333330 points  0.99733333330

Test #82:

score: 74.93
Acceptable Answer
time: 3ms
memory: 3848kb

input:

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

output:

8
0 1737
8
2
8
0 61
8
2
8
0 538
8
2
8
0 1011
8
2
8
0 1566
8
2
8
0 997
8
2
8
0 644
8
2
8
0 1450
8
2
8
0 855
8
2
8
1 855
8
0 990
8
2
8
0 1586
8
2
8
1 1586
8
0 1989
8
2
8
0 1261
8
2
8
0 704
8
2
8
0 1671
8
2
8
0 1018
8
2
8
0 979
8
2
8
0 1424
8
2
8
0 575
8
2
8
0 379
8
2
8
1 379
8
0 658
8
2
8
1 658
8
0 15...

result:

points 0.99906666670 points  0.99906666670

Test #83:

score: 74.93
Acceptable Answer
time: 8ms
memory: 3932kb

input:

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

output:

8
0 1810
8
2
8
0 216
8
2
8
0 767
8
2
8
0 1719
8
2
8
0 762
8
2
8
0 342
8
2
8
0 1825
8
2
8
0 576
8
2
8
0 1921
8
2
8
0 1873
8
2
8
0 883
8
2
8
1 883
8
0 1784
8
2
8
0 1288
8
2
8
1 1288
8
0 1861
8
2
8
0 632
8
2
8
1 632
8
0 285
8
2
8
0 1438
8
2
8
0 482
8
2
8
0 988
8
2
8
0 567
8
2
8
0 1381
8
2
8
0 1924
8
2
...

result:

points 0.99906666670 points  0.99906666670

Test #84:

score: 45.61
Acceptable Answer
time: 7ms
memory: 3836kb

input:

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

output:

8
0 259
8
2
8
0 216
8
2
8
0 108
8
2
8
1 108
8
0 187
8
2
8
1 187
8
0 126
8
2
8
0 342
8
2
8
1 342
8
0 152
8
2
8
0 398
8
2
8
1 398
8
0 522
8
2
8
1 522
8
0 391
8
2
8
1 391
8
0 85
8
2
8
1 85
8
0 252
8
2
8
1 252
8
0 461
8
2
8
1 461
8
0 489
8
2
8
1 489
8
0 262
8
2
8
1 262
8
0 285
8
2
8
1 285
8
0 66
8
2
8
1...

result:

points 0.60813333330 points  0.60813333330

Test #85:

score: 32.28
Acceptable Answer
time: 16ms
memory: 3852kb

input:

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

output:

8
0 1810
8
2
8
0 216
8
2
8
1 216
8
0 767
8
2
8
1 767
8
0 1719
8
2
8
1 1719
8
0 762
8
2
8
0 342
8
2
8
1 342
8
0 1825
8
2
8
1 1825
8
0 576
8
2
8
1 576
8
0 1807
8
2
8
1 1807
8
0 1513
8
2
8
1 1513
8
0 883
8
2
8
1 883
8
0 1784
8
2
8
1 1784
8
0 1288
8
2
8
1 1288
8
0 895
8
2
8
1 895
8
0 632
8
2
8
1 632
8
0...

result:

points 0.43040 points  0.43040

Test #86:

score: 75
Accepted
time: 24ms
memory: 3860kb

input:

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

output:

8
0 599
8
2
8
0 999
8
2
8
0 964
8
2
8
1 964
8
0 1720
8
2
8
1 1720
8
0 764
8
2
8
1 764
8
0 109
8
2
8
1 109
8
0 260
8
2
8
1 260
8
0 958
8
2
8
1 958
8
0 268
8
2
8
1 268
8
0 1631
8
2
8
1 1631
8
0 1860
8
2
8
1 1860
8
0 985
8
2
8
1 985
8
0 1953
8
2
8
1 1953
8
0 725
8
2
8
1 725
8
0 279
8
2
8
1 279
8
0 106
...

result:

ok 

Test #87:

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

input:

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

output:

8
0 599
8
2
8
0 999
8
2
8
1 999
8
0 964
8
2
8
1 964
8
0 1720
8
2
8
0 764
8
2
8
1 764
8
0 109
8
2
8
1 109
8
0 260
8
2
8
1 260
8
0 958
8
2
8
1 958
8
0 268
8
2
8
1 268
8
0 1631
8
2
8
0 1860
8
2
8
0 985
8
2
8
1 985
8
0 1953
8
2
8
0 725
8
2
8
1 725
8
0 279
8
2
8
1 279
8
0 106
8
2
8
1 106
8
0 881
8
2
8
1 ...

result:

ok 

Test #88:

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

input:

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

output:

8
0 599
8
2
8
0 999
8
2
8
0 964
8
2
8
0 1720
8
2
8
1 1720
8
0 764
8
2
8
0 109
8
2
8
0 260
8
2
8
0 958
8
2
8
0 268
8
2
8
0 1631
8
2
8
1 1631
8
0 1860
8
2
8
1 1860
8
0 985
8
2
8
0 1953
8
2
8
1 1953
8
0 725
8
2
8
0 279
8
2
8
0 106
8
2
8
0 881
8
2
8
0 1368
8
2
8
1 1368
8
0 642
8
2
8
0 1792
8
2
8
1 1792
...

result:

ok 

Test #89:

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

input:

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

output:

8
0 599
8
2
8
0 999
8
2
8
0 964
8
2
8
0 1720
8
2
8
0 764
8
2
8
0 109
8
2
8
1 109
8
0 260
8
2
8
1 260
8
0 958
8
2
8
0 268
8
2
8
1 268
8
0 1631
8
2
8
1 1631
8
0 1860
8
2
8
1 1860
8
0 985
8
2
8
0 1953
8
2
8
1 1953
8
0 725
8
2
8
0 279
8
2
8
1 279
8
0 106
8
2
8
1 106
8
0 881
8
2
8
0 1368
8
2
8
0 642
8
2
...

result:

ok