QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#430259#4565. Rarest Insectsjames1BadCreeper63.06 35ms4300kbC++171.9kb2024-06-03 16:47:542024-06-03 16:47:55

Judging History

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

  • [2024-06-03 16:47:55]
  • 评测
  • 测评结果:63.06
  • 用时:35ms
  • 内存:4300kb
  • [2024-06-03 16:47:54]
  • 提交

answer

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

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

inline void Move_inside(int x) { move_inside(id[x] - 1); }
inline void Move_outside(int x) { move_outside(id[x] - 1); }
int check(int x) { // 最罕见的昆虫是否能 >= x
    int cnt = n - arr.size(); 
    shuffle(arr.begin(), arr.end(), Rand); 

    set<int> newarr; 
    for (int i : arr) newarr.insert(i); 

    shuffle(arr.begin(), arr.end(), Rand); 
    for (int i : arr) {
        if (cnt == k * x) break; 
        Move_inside(i); in[i] = 1; ++cnt; newarr.erase(i); 
        if (press_button() > x) {
            Move_outside(i); in[i] = 0; --cnt; newarr.insert(i); 
            // if (cnt < k * x) {
                // for (int i : arr)
                    // if (in[i]) Move_outside(i), in[i] = 0; 
                // return cnt; 
            // }
        }
    }
    if (cnt == k * x) {
        arr.clear(); 
        for (int i : newarr) arr.emplace_back(i); 
        // for (int i : newarr) in[i] = 0; 
        return -1; 
    }
    for (int i : arr)
        if (in[i]) Move_outside(i), in[i] = 0; 
    return cnt; 
}

int min_cardinality(int N) {
    n = N; 
    k = n; 
    for (int i = 1; i <= n; ++i) always_no[i] = 0, id[i] = i; 
    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);  
    }
    if (k == 1) return n; 

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

    while (L + 1 != R) {
        int mid = L + R >> 1; 
        int val = check(mid); 
        if (val == -1) L = mid; 
        else R = min(mid, max(L + 1, val / k + 1)); 
    }
    return L; 
}

詳細信息

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

6
1
1
1
2
2
2
2
2
3

output:

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

result:

ok 

Test #2:

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

input:

2
1
2

output:

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

result:

ok 

Test #3:

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

input:

2
1
1

output:

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

result:

ok 

Test #4:

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

input:

3
1
2
1

output:

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

result:

ok 

Test #5:

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

input:

5
1
1
2
2
2
2
3
2

output:

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

result:

ok 

Test #6:

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

input:

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

output:

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

result:

ok 

Test #7:

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

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 80
8
2
8
0 99
8
2
8
1 99
8
0 170
8
2
8
1 170
8
0 176
8
2
8
1 176
8
0 26
8
2
8
1 26
8
0 67
8
2
8
1 67
8
0 169
8
2
8
1 169
8
0 107
8
2
8
1 107
8
0 4
8
2
8
1 4
8
0 31
8
2
8
1 31
8
0 113
8
2
8
1 113
8
0 69
8
2
8
1 69
8
0 118
8
2
8
1 118
8
0 152
8
2
8
1 152
8
0 194
8
2
8
1 194
8
0 35
8
2
8
1 35
8
0 6...

result:

ok 

Test #8:

score: 10
Accepted
time: 2ms
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 1
8
2
8
0 111
8
2
8
0 78
8
2
8
0 120
8
2
8
0 103
8
2
8
0 168
8
2
8
0 82
8
2
8
0 106
8
2
8
0 177
8
2
8
0 30
8
2
8
0 112
8
2
8
0 68
8
2
8
0 97
8
2
8
0 12
8
2
8
0 74
8
2
8
0 18
8
2
8
0 85
8
2
8
0 127
8
2
8
0 141
8
2
8
0 193
8
2
8
0 69
8
2
8
0 3
8
2
8
0 183
8
2
8
0 146
8
2
8
0 9
8
2
8
0 93
8
2
8
0 1...

result:

ok 

Test #9:

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

input:

200
1
1
1
1
1
1
2
2
1
1
2
2
2
2
1
2
2
1
2
2
1
2
2
1
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1
8
2
8
0 111
8
2
8
0 78
8
2
8
0 120
8
2
8
0 103
8
2
8
0 168
8
2
8
0 82
8
2
8
1 82
8
0 106
8
2
8
1 106
8
0 177
8
2
8
0 30
8
2
8
0 112
8
2
8
1 112
8
0 68
8
2
8
1 68
8
0 97
8
2
8
1 97
8
0 12
8
2
8
1 12
8
0 74
8
2
8
0 18
8
2
8
1 18
8
0 85
8
2
8
1 85
8
0 127
8
2
8
0 141
8
2
8
1 141
8
0 193
8
2
8
1 1...

result:

ok 

Test #10:

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

input:

198
1
1
2
1
2
1
1
1
1
1
2
1
2
2
2
2
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
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1
8
2
8
0 111
8
2
8
0 78
8
2
8
1 78
8
0 120
8
2
8
0 103
8
2
8
1 103
8
0 168
8
2
8
0 82
8
2
8
0 106
8
2
8
0 177
8
2
8
0 30
8
2
8
0 112
8
2
8
1 112
8
0 68
8
2
8
0 97
8
2
8
1 97
8
0 12
8
2
8
1 12
8
0 74
8
2
8
1 74
8
0 18
8
2
8
1 18
8
0 85
8
2
8
1 85
8
0 127
8
2
8
1 127
8
0 141
8
2
8
1 141
8
0 193
8...

result:

ok 

Test #11:

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

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

output:

8
0 95
8
2
8
0 49
8
2
8
1 49
8
0 126
8
2
8
1 126
8
0 62
8
2
8
1 62
8
0 10
8
2
8
1 10
8
0 53
8
2
8
1 53
8
0 96
8
2
8
1 96
8
0 178
8
2
8
1 178
8
0 60
8
2
8
1 60
8
0 151
8
2
8
1 151
8
0 87
8
2
8
1 87
8
0 150
8
2
8
1 150
8
0 107
8
2
8
1 107
8
0 99
8
2
8
1 99
8
0 69
8
2
8
1 69
8
0 172
8
2
8
1 172
8
0 114...

result:

ok 

Test #12:

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

input:

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

output:

8
0 95
8
2
8
0 49
8
2
8
0 126
8
2
8
1 126
8
0 62
8
2
8
1 62
8
0 10
8
2
8
0 53
8
2
8
1 53
8
0 96
8
2
8
0 178
8
2
8
1 178
8
0 60
8
2
8
1 60
8
0 151
8
2
8
1 151
8
0 87
8
2
8
1 87
8
0 150
8
2
8
0 107
8
2
8
0 99
8
2
8
1 99
8
0 69
8
2
8
1 69
8
0 172
8
2
8
0 114
8
2
8
1 114
8
0 133
8
2
8
0 90
8
2
8
0 153
8...

result:

ok 

Test #13:

score: 10
Accepted
time: 7ms
memory: 3904kb

input:

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

output:

8
0 95
8
2
8
0 49
8
2
8
0 126
8
2
8
1 126
8
0 62
8
2
8
0 10
8
2
8
0 53
8
2
8
1 53
8
0 96
8
2
8
1 96
8
0 178
8
2
8
1 178
8
0 60
8
2
8
1 60
8
0 151
8
2
8
1 151
8
0 87
8
2
8
1 87
8
0 150
8
2
8
1 150
8
0 107
8
2
8
1 107
8
0 99
8
2
8
1 99
8
0 69
8
2
8
1 69
8
0 172
8
2
8
1 172
8
0 114
8
2
8
1 114
8
0 133
...

result:

ok 

Test #14:

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

input:

198
1
1
2
1
1
1
2
2
1
2
1
2
2
1
2
2
1
1
2
2
1
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 109
8
2
8
0 115
8
2
8
0 57
8
2
8
1 57
8
0 169
8
2
8
0 23
8
2
8
0 129
8
2
8
0 55
8
2
8
1 55
8
0 46
8
2
8
1 46
8
0 79
8
2
8
0 150
8
2
8
1 150
8
0 86
8
2
8
0 76
8
2
8
1 76
8
0 106
8
2
8
1 106
8
0 98
8
2
8
0 68
8
2
8
1 68
8
0 50
8
2
8
1 50
8
0 43
8
2
8
0 132
8
2
8
0 45
8
2
8
1 45
8
0 187
8
2
8
1 187...

result:

ok 

Test #15:

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

input:

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

output:

8
0 109
8
2
8
0 115
8
2
8
0 199
8
2
8
1 199
8
0 169
8
2
8
1 169
8
0 23
8
2
8
0 129
8
2
8
1 129
8
0 55
8
2
8
1 55
8
0 46
8
2
8
0 79
8
2
8
0 150
8
2
8
1 150
8
0 86
8
2
8
1 86
8
0 76
8
2
8
1 76
8
0 106
8
2
8
1 106
8
0 98
8
2
8
1 98
8
0 68
8
2
8
1 68
8
0 50
8
2
8
1 50
8
0 43
8
2
8
1 43
8
0 132
8
2
8
1 1...

result:

ok 

Test #16:

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

input:

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

output:

8
0 109
8
2
8
0 115
8
2
8
0 57
8
2
8
1 57
8
0 169
8
2
8
0 23
8
2
8
0 129
8
2
8
1 129
8
0 55
8
2
8
1 55
8
0 46
8
2
8
0 79
8
2
8
1 79
8
0 150
8
2
8
1 150
8
0 86
8
2
8
1 86
8
0 76
8
2
8
1 76
8
0 106
8
2
8
0 98
8
2
8
0 68
8
2
8
1 68
8
0 50
8
2
8
1 50
8
0 43
8
2
8
1 43
8
0 132
8
2
8
0 45
8
2
8
1 45
8
0 1...

result:

ok 

Test #17:

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

input:

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

output:

8
0 95
8
2
8
0 49
8
2
8
0 126
8
2
8
0 62
8
2
8
0 10
8
2
8
0 53
8
2
8
0 96
8
2
8
1 96
8
0 178
8
2
8
1 178
8
0 60
8
2
8
1 60
8
0 151
8
2
8
0 87
8
2
8
1 87
8
0 150
8
2
8
1 150
8
0 107
8
2
8
1 107
8
0 99
8
2
8
1 99
8
0 69
8
2
8
1 69
8
0 172
8
2
8
1 172
8
0 114
8
2
8
1 114
8
0 133
8
2
8
1 133
8
0 90
8
2
...

result:

ok 

Test #18:

score: 10
Accepted
time: 4ms
memory: 3876kb

input:

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

output:

8
0 109
8
2
8
0 115
8
2
8
0 57
8
2
8
0 169
8
2
8
0 23
8
2
8
1 23
8
0 129
8
2
8
0 55
8
2
8
0 46
8
2
8
1 46
8
0 79
8
2
8
0 150
8
2
8
1 150
8
0 86
8
2
8
1 86
8
0 76
8
2
8
1 76
8
0 106
8
2
8
1 106
8
0 98
8
2
8
0 68
8
2
8
1 68
8
0 50
8
2
8
1 50
8
0 43
8
2
8
1 43
8
0 132
8
2
8
1 132
8
0 45
8
2
8
1 45
8
0 ...

result:

ok 

Test #19:

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

input:

196
1
1
1
1
1
1
1
1
1
1
2
1
1
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
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 109
8
2
8
0 115
8
2
8
0 57
8
2
8
0 169
8
2
8
0 23
8
2
8
0 129
8
2
8
0 55
8
2
8
0 46
8
2
8
0 79
8
2
8
0 150
8
2
8
0 86
8
2
8
1 86
8
0 76
8
2
8
0 106
8
2
8
0 98
8
2
8
1 98
8
0 68
8
2
8
1 68
8
0 50
8
2
8
1 50
8
0 43
8
2
8
1 43
8
0 132
8
2
8
1 132
8
0 45
8
2
8
1 45
8
0 187
8
2
8
0 149
8
2
8
1 149
8
...

result:

ok 

Test #20:

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

input:

196
1
1
1
1
1
1
1
2
1
1
2
2
2
1
2
1
2
1
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 109
8
2
8
0 115
8
2
8
0 57
8
2
8
0 169
8
2
8
0 23
8
2
8
0 129
8
2
8
0 55
8
2
8
0 46
8
2
8
1 46
8
0 79
8
2
8
0 150
8
2
8
0 86
8
2
8
1 86
8
0 76
8
2
8
1 76
8
0 106
8
2
8
1 106
8
0 98
8
2
8
0 68
8
2
8
1 68
8
0 50
8
2
8
0 43
8
2
8
1 43
8
0 132
8
2
8
0 45
8
2
8
1 45
8
0 187
8
2
8
1 187
8
0 149
8
2
8
...

result:

ok 

Test #21:

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

input:

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

output:

8
0 109
8
2
8
0 115
8
2
8
0 199
8
2
8
0 169
8
2
8
0 23
8
2
8
0 129
8
2
8
0 55
8
2
8
0 46
8
2
8
1 46
8
0 79
8
2
8
0 150
8
2
8
0 86
8
2
8
0 76
8
2
8
0 106
8
2
8
0 98
8
2
8
0 68
8
2
8
0 50
8
2
8
0 43
8
2
8
1 43
8
0 132
8
2
8
0 45
8
2
8
0 187
8
2
8
1 187
8
0 149
8
2
8
1 149
8
0 9
8
2
8
1 9
8
0 81
8
2
8
...

result:

ok 

Test #22:

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

input:

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

output:

8
0 95
8
2
8
0 49
8
2
8
0 126
8
2
8
0 62
8
2
8
0 10
8
2
8
0 53
8
2
8
0 96
8
2
8
0 178
8
2
8
0 60
8
2
8
0 151
8
2
8
0 87
8
2
8
0 150
8
2
8
1 150
8
0 107
8
2
8
0 99
8
2
8
0 69
8
2
8
0 172
8
2
8
0 114
8
2
8
0 133
8
2
8
0 90
8
2
8
0 153
8
2
8
0 73
8
2
8
0 13
8
2
8
0 50
8
2
8
0 105
8
2
8
0 92
8
2
8
0 148...

result:

ok 

Test #23:

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

input:

198
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
2
1
1
1
1
1
1
1
1
1
2
1
1
1
2
1
2
1
1
2
2
1
1
2
2
2
1
1
1
2
1
2
1
2
2
2
1
1
1
1
1
2
1
2
2
1
2
1
1
1
2
1
1
2
1
1
1
2
1
1
2
1
2
2
1
2
2
1
2
2
1
1
1
1
1
1
2
1
1
1
1
2
2
1
1
2
2
1
1
1
1
2
1
1
2
2
2
1
1
1
2
1
1
1
2
1
...

output:

8
0 109
8
2
8
0 115
8
2
8
0 57
8
2
8
0 169
8
2
8
0 23
8
2
8
0 129
8
2
8
0 55
8
2
8
0 46
8
2
8
0 79
8
2
8
0 150
8
2
8
0 86
8
2
8
0 76
8
2
8
0 106
8
2
8
0 98
8
2
8
0 68
8
2
8
1 68
8
0 50
8
2
8
0 43
8
2
8
0 132
8
2
8
0 45
8
2
8
0 187
8
2
8
0 149
8
2
8
0 9
8
2
8
0 81
8
2
8
0 104
8
2
8
1 104
8
0 123
8
2
...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

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

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 762
8
2
8
0 733
8
2
8
1 733
8
0 199
8
2
8
1 199
8
0 475
8
2
8
1 475
8
0 597
8
2
8
1 597
8
0 316
8
2
8
1 316
8
0 313
8
2
8
1 313
8
0 46
8
2
8
1 46
8
0 79
8
2
8
1 79
8
0 598
8
2
8
1 598
8
0 86
8
2
8
1 86
8
0 432
8
2
8
1 432
8
0 106
8
2
8
1 106
8
0 441
8
2
8
1 441
8
0 604
8
2
8
1 604
8
0 434
8
2
8
...

result:

ok 

Test #25:

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

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 762
8
2
8
0 733
8
2
8
0 199
8
2
8
0 475
8
2
8
0 597
8
2
8
0 316
8
2
8
0 313
8
2
8
0 46
8
2
8
0 79
8
2
8
0 598
8
2
8
0 86
8
2
8
0 432
8
2
8
0 106
8
2
8
0 441
8
2
8
0 604
8
2
8
0 434
8
2
8
0 560
8
2
8
0 132
8
2
8
0 456
8
2
8
0 499
8
2
8
0 999
8
2
8
0 763
8
2
8
0 287
8
2
8
0 612
8
2
8
0 826
8
2
8
0...

result:

ok 

Test #26:

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

input:

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

output:

8
0 763
8
2
8
0 724
8
2
8
0 126
8
2
8
0 62
8
2
8
0 423
8
2
8
0 317
8
2
8
0 96
8
2
8
1 96
8
0 372
8
2
8
0 484
8
2
8
0 599
8
2
8
0 87
8
2
8
0 433
8
2
8
0 107
8
2
8
0 720
8
2
8
0 605
8
2
8
0 772
8
2
8
0 561
8
2
8
1 561
8
0 133
8
2
8
1 133
8
0 944
8
2
8
1 944
8
0 153
8
2
8
0 430
8
2
8
1 430
8
0 994
8
2
...

result:

ok 

Test #27:

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

input:

999
1
1
1
1
2
1
1
1
1
1
2
1
1
2
2
1
2
1
2
2
1
1
2
1
2
1
1
2
1
2
2
2
1
1
1
1
1
2
2
1
2
2
1
2
2
2
2
1
2
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 763
8
2
8
0 724
8
2
8
0 126
8
2
8
0 62
8
2
8
0 423
8
2
8
1 423
8
0 317
8
2
8
0 96
8
2
8
0 372
8
2
8
0 484
8
2
8
0 599
8
2
8
0 87
8
2
8
1 87
8
0 433
8
2
8
0 107
8
2
8
0 720
8
2
8
1 720
8
0 605
8
2
8
1 605
8
0 772
8
2
8
0 561
8
2
8
1 561
8
0 133
8
2
8
0 944
8
2
8
1 944
8
0 153
8
2
8
1 153
8
0 430
...

result:

ok 

Test #28:

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

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 762
8
2
8
0 733
8
2
8
1 733
8
0 199
8
2
8
1 199
8
0 475
8
2
8
1 475
8
0 597
8
2
8
1 597
8
0 316
8
2
8
1 316
8
0 313
8
2
8
1 313
8
0 46
8
2
8
1 46
8
0 79
8
2
8
1 79
8
0 598
8
2
8
1 598
8
0 86
8
2
8
1 86
8
0 432
8
2
8
1 432
8
0 106
8
2
8
1 106
8
0 441
8
2
8
1 441
8
0 604
8
2
8
1 604
8
0 434
8
2
8
...

result:

ok 

Test #29:

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

input:

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

output:

8
0 39
8
2
8
0 359
8
2
8
0 405
8
2
8
0 287
8
2
8
0 771
8
2
8
1 771
8
0 558
8
2
8
1 558
8
0 246
8
2
8
1 246
8
0 240
8
2
8
1 240
8
0 708
8
2
8
1 708
8
0 131
8
2
8
1 131
8
0 273
8
2
8
0 238
8
2
8
1 238
8
0 858
8
2
8
0 18
8
2
8
0 716
8
2
8
0 84
8
2
8
1 84
8
0 278
8
2
8
1 278
8
0 984
8
2
8
1 984
8
0 479
...

result:

ok 

Test #30:

score: 15
Accepted
time: 15ms
memory: 3956kb

input:

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

output:

8
0 38
8
2
8
0 643
8
2
8
0 404
8
2
8
1 404
8
0 511
8
2
8
0 770
8
2
8
1 770
8
0 801
8
2
8
1 801
8
0 124
8
2
8
1 124
8
0 127
8
2
8
1 127
8
0 317
8
2
8
1 317
8
0 931
8
2
8
1 931
8
0 272
8
2
8
0 261
8
2
8
1 261
8
0 400
8
2
8
1 400
8
0 232
8
2
8
1 232
8
0 416
8
2
8
1 416
8
0 561
8
2
8
1 561
8
0 611
8
2
8...

result:

ok 

Test #31:

score: 15
Accepted
time: 16ms
memory: 3964kb

input:

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

output:

8
0 38
8
2
8
0 643
8
2
8
0 404
8
2
8
0 511
8
2
8
0 770
8
2
8
0 801
8
2
8
0 124
8
2
8
0 127
8
2
8
0 317
8
2
8
0 931
8
2
8
0 272
8
2
8
0 261
8
2
8
0 400
8
2
8
1 400
8
0 232
8
2
8
0 416
8
2
8
0 561
8
2
8
1 561
8
0 611
8
2
8
1 611
8
0 120
8
2
8
0 478
8
2
8
0 86
8
2
8
1 86
8
0 320
8
2
8
0 736
8
2
8
1 736...

result:

ok 

Test #32:

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

input:

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

output:

8
0 38
8
2
8
0 643
8
2
8
0 404
8
2
8
1 404
8
0 511
8
2
8
1 511
8
0 770
8
2
8
0 801
8
2
8
1 801
8
0 124
8
2
8
1 124
8
0 127
8
2
8
1 127
8
0 317
8
2
8
1 317
8
0 931
8
2
8
1 931
8
0 272
8
2
8
0 261
8
2
8
0 400
8
2
8
1 400
8
0 232
8
2
8
1 232
8
0 416
8
2
8
1 416
8
0 561
8
2
8
1 561
8
0 611
8
2
8
1 611
8...

result:

ok 

Test #33:

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

input:

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

output:

8
0 38
8
2
8
0 643
8
2
8
0 404
8
2
8
0 511
8
2
8
1 511
8
0 770
8
2
8
0 801
8
2
8
1 801
8
0 124
8
2
8
1 124
8
0 127
8
2
8
1 127
8
0 317
8
2
8
1 317
8
0 931
8
2
8
1 931
8
0 272
8
2
8
1 272
8
0 261
8
2
8
0 400
8
2
8
0 232
8
2
8
1 232
8
0 416
8
2
8
1 416
8
0 561
8
2
8
1 561
8
0 611
8
2
8
0 120
8
2
8
1 1...

result:

ok 

Test #34:

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

input:

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

output:

8
0 38
8
2
8
0 643
8
2
8
0 404
8
2
8
0 511
8
2
8
0 770
8
2
8
0 801
8
2
8
0 124
8
2
8
0 127
8
2
8
1 127
8
0 317
8
2
8
1 317
8
0 931
8
2
8
1 931
8
0 272
8
2
8
1 272
8
0 261
8
2
8
1 261
8
0 400
8
2
8
1 400
8
0 232
8
2
8
0 416
8
2
8
1 416
8
0 561
8
2
8
1 561
8
0 611
8
2
8
1 611
8
0 120
8
2
8
1 120
8
0 4...

result:

ok 

Test #35:

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

input:

1000
1
1
1
1
1
1
2
2
1
1
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 753
8
2
8
0 549
8
2
8
0 530
8
2
8
0 445
8
2
8
0 658
8
2
8
0 25
8
2
8
0 58
8
2
8
1 58
8
0 133
8
2
8
1 133
8
0 428
8
2
8
0 972
8
2
8
0 100
8
2
8
1 100
8
0 142
8
2
8
1 142
8
0 168
8
2
8
1 168
8
0 844
8
2
8
1 844
8
0 645
8
2
8
0 420
8
2
8
1 420
8
0 513
8
2
8
1 513
8
0 602
8
2
8
1 602
8
0 922
8
2
8
0...

result:

ok 

Test #36:

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

input:

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

output:

8
0 449
8
2
8
0 175
8
2
8
0 564
8
2
8
0 228
8
2
8
0 659
8
2
8
0 28
8
2
8
0 70
8
2
8
1 70
8
0 52
8
2
8
1 52
8
0 95
8
2
8
0 973
8
2
8
1 973
8
0 868
8
2
8
0 143
8
2
8
0 174
8
2
8
1 174
8
0 845
8
2
8
1 845
8
0 676
8
2
8
0 970
8
2
8
0 362
8
2
8
1 362
8
0 800
8
2
8
0 923
8
2
8
0 239
8
2
8
1 239
8
0 892
8
...

result:

ok 

Test #37:

score: 15
Accepted
time: 17ms
memory: 3956kb

input:

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

output:

8
0 449
8
2
8
0 175
8
2
8
0 564
8
2
8
0 228
8
2
8
0 659
8
2
8
0 28
8
2
8
0 70
8
2
8
0 52
8
2
8
1 52
8
0 95
8
2
8
0 973
8
2
8
1 973
8
0 868
8
2
8
0 143
8
2
8
1 143
8
0 174
8
2
8
1 174
8
0 845
8
2
8
1 845
8
0 676
8
2
8
1 676
8
0 970
8
2
8
1 970
8
0 362
8
2
8
1 362
8
0 800
8
2
8
0 923
8
2
8
1 923
8
0 2...

result:

ok 

Test #38:

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

input:

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

output:

8
0 449
8
2
8
0 175
8
2
8
0 564
8
2
8
0 228
8
2
8
0 659
8
2
8
0 28
8
2
8
0 70
8
2
8
0 52
8
2
8
0 95
8
2
8
0 973
8
2
8
0 868
8
2
8
0 143
8
2
8
0 174
8
2
8
1 174
8
0 845
8
2
8
1 845
8
0 676
8
2
8
0 970
8
2
8
0 362
8
2
8
0 800
8
2
8
0 923
8
2
8
0 239
8
2
8
0 892
8
2
8
1 892
8
0 252
8
2
8
1 252
8
0 518
...

result:

ok 

Test #39:

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

input:

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

output:

8
0 449
8
2
8
0 175
8
2
8
0 564
8
2
8
0 228
8
2
8
0 659
8
2
8
0 28
8
2
8
0 70
8
2
8
0 52
8
2
8
0 95
8
2
8
0 973
8
2
8
0 868
8
2
8
0 143
8
2
8
0 174
8
2
8
0 845
8
2
8
0 676
8
2
8
0 970
8
2
8
0 362
8
2
8
0 800
8
2
8
0 923
8
2
8
1 923
8
0 239
8
2
8
0 892
8
2
8
0 252
8
2
8
0 518
8
2
8
1 518
8
0 403
8
2
...

result:

ok 

Test #40:

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

input:

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

output:

8
0 753
8
2
8
0 549
8
2
8
0 530
8
2
8
0 445
8
2
8
0 658
8
2
8
0 25
8
2
8
1 25
8
0 58
8
2
8
0 133
8
2
8
0 428
8
2
8
0 972
8
2
8
0 100
8
2
8
0 142
8
2
8
0 168
8
2
8
0 844
8
2
8
0 645
8
2
8
0 420
8
2
8
0 513
8
2
8
0 602
8
2
8
0 922
8
2
8
0 547
8
2
8
0 349
8
2
8
0 250
8
2
8
1 250
8
0 81
8
2
8
0 715
8
2
...

result:

ok 

Test #41:

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

input:

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

output:

8
0 449
8
2
8
0 175
8
2
8
0 564
8
2
8
0 228
8
2
8
0 659
8
2
8
0 28
8
2
8
0 70
8
2
8
0 52
8
2
8
0 95
8
2
8
0 973
8
2
8
0 868
8
2
8
0 143
8
2
8
0 174
8
2
8
0 845
8
2
8
0 676
8
2
8
0 970
8
2
8
0 362
8
2
8
0 800
8
2
8
0 923
8
2
8
1 923
8
0 239
8
2
8
0 892
8
2
8
0 252
8
2
8
0 518
8
2
8
0 403
8
2
8
0 606
...

result:

ok 

Test #42:

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

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

output:

8
0 449
8
2
8
0 175
8
2
8
0 564
8
2
8
0 228
8
2
8
0 659
8
2
8
0 28
8
2
8
0 70
8
2
8
0 52
8
2
8
0 95
8
2
8
0 973
8
2
8
0 868
8
2
8
0 143
8
2
8
0 174
8
2
8
0 845
8
2
8
0 676
8
2
8
0 970
8
2
8
0 362
8
2
8
0 800
8
2
8
0 923
8
2
8
0 239
8
2
8
0 892
8
2
8
0 252
8
2
8
0 518
8
2
8
0 403
8
2
8
0 606
8
2
8
0 ...

result:

ok 

Subtask #3:

score: 38.06
Acceptable Answer

Test #43:

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

input:

2
1
2

output:

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

result:

ok 

Test #44:

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

input:

2
1
1

output:

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

result:

ok 

Test #45:

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

input:

3
1
1
2

output:

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

result:

ok 

Test #46:

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

input:

6
1
2
2
2
2
1
2
3
3
3

output:

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

result:

ok 

Test #47:

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

input:

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

output:

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

result:

ok 

Test #48:

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

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 1436
8
2
8
0 549
8
2
8
1 549
8
0 1919
8
2
8
1 1919
8
0 1361
8
2
8
1 1361
8
0 658
8
2
8
1 658
8
0 1811
8
2
8
1 1811
8
0 58
8
2
8
1 58
8
0 133
8
2
8
1 133
8
0 1539
8
2
8
1 1539
8
0 972
8
2
8
1 972
8
0 1974
8
2
8
1 1974
8
0 142
8
2
8
1 142
8
0 168
8
2
8
1 168
8
0 1349
8
2
8
1 1349
8
0 645
8
2
8
1 6...

result:

ok 

Test #49:

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

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 1361
8
2
8
0 563
8
2
8
0 632
8
2
8
0 1183
8
2
8
0 970
8
2
8
0 375
8
2
8
0 481
8
2
8
0 640
8
2
8
0 1801
8
2
8
0 1222
8
2
8
0 39
8
2
8
0 1204
8
2
8
0 1456
8
2
8
0 638
8
2
8
0 1579
8
2
8
0 193
8
2
8
0 875
8
2
8
0 98
8
2
8
0 1869
8
2
8
0 448
8
2
8
0 1216
8
2
8
0 511
8
2
8
0 647
8
2
8
0 1559
8
2
8
0 ...

result:

ok 

Test #50:

score: 75
Accepted
time: 14ms
memory: 4300kb

input:

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

output:

8
0 1361
8
2
8
0 563
8
2
8
0 632
8
2
8
0 1183
8
2
8
0 970
8
2
8
0 375
8
2
8
1 375
8
0 481
8
2
8
0 640
8
2
8
0 1801
8
2
8
0 1222
8
2
8
0 39
8
2
8
0 1204
8
2
8
0 1456
8
2
8
1 1456
8
0 638
8
2
8
0 1579
8
2
8
1 1579
8
0 193
8
2
8
0 875
8
2
8
0 98
8
2
8
0 1869
8
2
8
0 448
8
2
8
0 1216
8
2
8
1 1216
8
0 51...

result:

ok 

Test #51:

score: 70.6
Acceptable Answer
time: 4ms
memory: 3892kb

input:

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

output:

8
0 1361
8
2
8
0 563
8
2
8
0 632
8
2
8
0 1183
8
2
8
0 970
8
2
8
0 375
8
2
8
0 481
8
2
8
0 640
8
2
8
0 1801
8
2
8
0 1222
8
2
8
0 39
8
2
8
0 1204
8
2
8
0 1456
8
2
8
1 1456
8
0 638
8
2
8
0 1579
8
2
8
1 1579
8
0 193
8
2
8
0 875
8
2
8
1 875
8
0 98
8
2
8
1 98
8
0 1869
8
2
8
0 448
8
2
8
1 448
8
0 1216
8
2
...

result:

points 0.94133333330 points  0.94133333330

Test #52:

score: 45.05
Acceptable Answer
time: 34ms
memory: 4012kb

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 1361
8
2
8
0 563
8
2
8
1 563
8
0 632
8
2
8
1 632
8
0 1183
8
2
8
1 1183
8
0 970
8
2
8
1 970
8
0 375
8
2
8
1 375
8
0 481
8
2
8
1 481
8
0 640
8
2
8
1 640
8
0 1801
8
2
8
1 1801
8
0 1222
8
2
8
1 1222
8
0 39
8
2
8
1 39
8
0 1204
8
2
8
1 1204
8
0 1456
8
2
8
1 1456
8
0 638
8
2
8
1 638
8
0 1579
8
2
8
1 15...

result:

points 0.60066666670 points  0.60066666670

Test #53:

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

input:

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

output:

8
0 610
8
2
8
0 523
8
2
8
0 410
8
2
8
0 593
8
2
8
1 593
8
0 95
8
2
8
1 95
8
0 172
8
2
8
0 928
8
2
8
1 928
8
0 1222
8
2
8
0 668
8
2
8
1 668
8
0 1907
8
2
8
1 1907
8
0 552
8
2
8
0 918
8
2
8
1 918
8
0 1933
8
2
8
0 505
8
2
8
1 505
8
0 285
8
2
8
0 1024
8
2
8
0 1167
8
2
8
1 1167
8
0 1398
8
2
8
0 1910
8
2
8...

result:

ok 

Test #54:

score: 38.06
Acceptable Answer
time: 33ms
memory: 4008kb

input:

2000
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 610
8
2
8
0 523
8
2
8
0 410
8
2
8
1 410
8
0 593
8
2
8
0 95
8
2
8
1 95
8
0 172
8
2
8
0 928
8
2
8
1 928
8
0 1222
8
2
8
1 1222
8
0 668
8
2
8
1 668
8
0 1907
8
2
8
1 1907
8
0 552
8
2
8
1 552
8
0 918
8
2
8
1 918
8
0 1933
8
2
8
1 1933
8
0 505
8
2
8
1 505
8
0 285
8
2
8
1 285
8
0 1024
8
2
8
1 1024
8
0 11...

result:

points 0.50746666670 points  0.50746666670

Test #55:

score: 57.87
Acceptable Answer
time: 35ms
memory: 4080kb

input:

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

output:

8
0 1755
8
2
8
0 960
8
2
8
0 700
8
2
8
0 1356
8
2
8
0 96
8
2
8
0 384
8
2
8
0 662
8
2
8
0 1124
8
2
8
0 200
8
2
8
0 1685
8
2
8
0 1805
8
2
8
0 637
8
2
8
0 1188
8
2
8
1 1188
8
0 1062
8
2
8
0 1199
8
2
8
1 1199
8
0 65
8
2
8
0 1270
8
2
8
1 1270
8
0 1074
8
2
8
1 1074
8
0 638
8
2
8
1 638
8
0 1706
8
2
8
0 821...

result:

points 0.77160 points  0.77160

Test #56:

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

input:

1998
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1755
8
2
8
0 960
8
2
8
0 700
8
2
8
1 700
8
0 1356
8
2
8
0 96
8
2
8
1 96
8
0 384
8
2
8
0 662
8
2
8
1 662
8
0 1124
8
2
8
1 1124
8
0 200
8
2
8
1 200
8
0 1685
8
2
8
1 1685
8
0 1805
8
2
8
1 1805
8
0 637
8
2
8
1 637
8
0 1188
8
2
8
0 1062
8
2
8
1 1062
8
0 1199
8
2
8
1 1199
8
0 65
8
2
8
1 65
8
0 1270
8
...

result:

ok 

Test #57:

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

input:

1999
1
1
1
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 299
8
2
8
0 1320
8
2
8
0 701
8
2
8
0 1357
8
2
8
0 1992
8
2
8
0 385
8
2
8
0 1734
8
2
8
1 1734
8
0 1125
8
2
8
1 1125
8
0 201
8
2
8
1 201
8
0 348
8
2
8
1 348
8
0 298
8
2
8
1 298
8
0 103
8
2
8
1 103
8
0 1189
8
2
8
1 1189
8
0 1063
8
2
8
1 1063
8
0 1161
8
2
8
1 1161
8
0 1376
8
2
8
0 1984
8
2
8
0 1075
...

result:

ok 

Test #58:

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

input:

1997
1
1
1
2
1
1
2
2
1
2
1
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1054
8
2
8
0 1623
8
2
8
0 514
8
2
8
0 1521
8
2
8
1 1521
8
0 114
8
2
8
0 213
8
2
8
0 1652
8
2
8
1 1652
8
0 916
8
2
8
1 916
8
0 863
8
2
8
0 1899
8
2
8
1 1899
8
0 1962
8
2
8
0 1374
8
2
8
0 397
8
2
8
1 397
8
0 150
8
2
8
0 1981
8
2
8
1 1981
8
0 1799
8
2
8
1 1799
8
0 708
8
2
8
1 708
8
0 1391
8
2
8
1 1...

result:

ok 

Test #59:

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

input:

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

output:

8
0 1341
8
2
8
0 1624
8
2
8
0 381
8
2
8
0 1520
8
2
8
1 1520
8
0 1789
8
2
8
0 1909
8
2
8
0 778
8
2
8
0 732
8
2
8
0 1061
8
2
8
1 1061
8
0 1900
8
2
8
0 1479
8
2
8
1 1479
8
0 1067
8
2
8
0 65
8
2
8
0 127
8
2
8
0 1982
8
2
8
1 1982
8
0 1800
8
2
8
1 1800
8
0 1171
8
2
8
0 1390
8
2
8
1 1390
8
0 962
8
2
8
1 96...

result:

ok 

Test #60:

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

input:

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

output:

8
0 1341
8
2
8
0 1624
8
2
8
0 381
8
2
8
0 1520
8
2
8
0 1789
8
2
8
0 1909
8
2
8
0 778
8
2
8
1 778
8
0 732
8
2
8
0 1061
8
2
8
1 1061
8
0 1900
8
2
8
0 1479
8
2
8
1 1479
8
0 1067
8
2
8
1 1067
8
0 65
8
2
8
0 127
8
2
8
1 127
8
0 1982
8
2
8
0 1800
8
2
8
1 1800
8
0 1171
8
2
8
1 1171
8
0 1390
8
2
8
1 1390
8
...

result:

ok 

Test #61:

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

input:

2000
1
1
1
1
1
1
1
1
2
2
2
1
2
2
1
1
1
1
1
1
2
2
1
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1341
8
2
8
0 1624
8
2
8
0 381
8
2
8
0 1520
8
2
8
0 1789
8
2
8
0 1909
8
2
8
0 778
8
2
8
0 732
8
2
8
0 1061
8
2
8
1 1061
8
0 1900
8
2
8
1 1900
8
0 1479
8
2
8
1 1479
8
0 1067
8
2
8
0 65
8
2
8
1 65
8
0 127
8
2
8
1 127
8
0 1982
8
2
8
0 1800
8
2
8
0 1171
8
2
8
0 1390
8
2
8
0 962
8
2
8
0 888
8
2
8
0 13...

result:

ok 

Test #62:

score: 72.4
Acceptable Answer
time: 13ms
memory: 3952kb

input:

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

output:

8
0 1726
8
2
8
0 1933
8
2
8
0 1486
8
2
8
0 1558
8
2
8
0 476
8
2
8
0 431
8
2
8
0 1103
8
2
8
0 304
8
2
8
0 1941
8
2
8
0 712
8
2
8
0 1405
8
2
8
1 1405
8
0 232
8
2
8
0 1419
8
2
8
0 1454
8
2
8
0 1188
8
2
8
0 314
8
2
8
0 810
8
2
8
0 1936
8
2
8
1 1936
8
0 187
8
2
8
0 1638
8
2
8
1 1638
8
0 15
8
2
8
0 1429
8...

result:

points 0.96533333330 points  0.96533333330

Test #63:

score: 73.13
Acceptable Answer
time: 8ms
memory: 4296kb

input:

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

output:

8
0 1726
8
2
8
0 1933
8
2
8
0 1486
8
2
8
0 1558
8
2
8
0 476
8
2
8
0 431
8
2
8
0 1103
8
2
8
0 304
8
2
8
0 1941
8
2
8
0 712
8
2
8
0 1405
8
2
8
0 232
8
2
8
0 1419
8
2
8
0 1454
8
2
8
0 1188
8
2
8
1 1188
8
0 314
8
2
8
0 810
8
2
8
0 1936
8
2
8
0 187
8
2
8
0 1638
8
2
8
0 15
8
2
8
0 1429
8
2
8
0 1688
8
2
8
...

result:

points 0.97506666670 points  0.97506666670

Test #64:

score: 71.88
Acceptable Answer
time: 4ms
memory: 4008kb

input:

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

output:

8
0 1727
8
2
8
0 1226
8
2
8
0 1487
8
2
8
0 1559
8
2
8
0 800
8
2
8
0 402
8
2
8
0 1544
8
2
8
0 428
8
2
8
0 1386
8
2
8
0 713
8
2
8
0 222
8
2
8
0 233
8
2
8
0 9
8
2
8
0 1455
8
2
8
0 1189
8
2
8
0 512
8
2
8
0 1384
8
2
8
1 1384
8
0 1937
8
2
8
0 167
8
2
8
1 167
8
0 1639
8
2
8
0 132
8
2
8
0 421
8
2
8
0 1689
8...

result:

points 0.95840 points  0.95840

Test #65:

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

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

output:

8
0 1727
8
2
8
0 1226
8
2
8
0 1487
8
2
8
0 1559
8
2
8
0 800
8
2
8
0 402
8
2
8
0 1544
8
2
8
0 428
8
2
8
0 1386
8
2
8
0 713
8
2
8
0 222
8
2
8
0 233
8
2
8
0 9
8
2
8
0 1455
8
2
8
0 1189
8
2
8
0 512
8
2
8
0 1384
8
2
8
0 1937
8
2
8
0 167
8
2
8
0 1639
8
2
8
0 132
8
2
8
0 421
8
2
8
0 1689
8
2
8
0 1082
8
2
8...

result:

ok 

Test #66:

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

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

output:

8
0 286
8
2
8
0 1641
8
2
8
0 1267
8
2
8
0 1544
8
2
8
0 1938
8
2
8
0 1526
8
2
8
0 1861
8
2
8
0 1397
8
2
8
0 454
8
2
8
0 427
8
2
8
0 1908
8
2
8
0 423
8
2
8
0 1126
8
2
8
0 856
8
2
8
0 280
8
2
8
0 1121
8
2
8
0 1946
8
2
8
0 434
8
2
8
0 1615
8
2
8
0 1586
8
2
8
0 1268
8
2
8
0 602
8
2
8
0 787
8
2
8
0 567
8
...

result:

ok 

Test #67:

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

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

output:

8
0 287
8
2
8
0 870
8
2
8
0 1868
8
2
8
0 1545
8
2
8
0 1939
8
2
8
0 1527
8
2
8
0 144
8
2
8
0 566
8
2
8
0 455
8
2
8
0 1316
8
2
8
0 1909
8
2
8
0 966
8
2
8
0 1440
8
2
8
0 857
8
2
8
0 796
8
2
8
0 406
8
2
8
0 1947
8
2
8
0 1118
8
2
8
0 843
8
2
8
0 1587
8
2
8
0 1269
8
2
8
0 1742
8
2
8
0 285
8
2
8
0 387
8
2
...

result:

ok 

Test #68:

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

input:

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

output:

8
0 287
8
2
8
0 870
8
2
8
0 1868
8
2
8
0 1545
8
2
8
0 1939
8
2
8
1 1939
8
0 1527
8
2
8
0 144
8
2
8
0 566
8
2
8
0 455
8
2
8
0 1316
8
2
8
0 1909
8
2
8
0 966
8
2
8
0 1440
8
2
8
0 857
8
2
8
0 796
8
2
8
0 406
8
2
8
1 406
8
0 1947
8
2
8
0 1118
8
2
8
0 843
8
2
8
0 1587
8
2
8
0 1269
8
2
8
0 1742
8
2
8
1 174...

result:

ok 

Test #69:

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

input:

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

output:

8
0 287
8
2
8
0 870
8
2
8
0 1868
8
2
8
0 1545
8
2
8
0 1939
8
2
8
1 1939
8
0 1527
8
2
8
0 144
8
2
8
0 566
8
2
8
0 455
8
2
8
0 1316
8
2
8
0 1909
8
2
8
0 966
8
2
8
0 1440
8
2
8
0 857
8
2
8
0 796
8
2
8
0 406
8
2
8
1 406
8
0 1947
8
2
8
0 1118
8
2
8
0 843
8
2
8
0 1587
8
2
8
0 1269
8
2
8
0 1742
8
2
8
1 174...

result:

ok 

Test #70:

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

input:

1979
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
2
1
2
1
1
1
2
2
1
2
2
2
1
2
2
1
2
2
1
2
1
2
2
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
1
2
2
2
2
2
2
2
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
2
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 287
8
2
8
0 870
8
2
8
0 1868
8
2
8
0 1545
8
2
8
0 1939
8
2
8
0 1527
8
2
8
0 144
8
2
8
0 566
8
2
8
0 455
8
2
8
0 1316
8
2
8
0 1909
8
2
8
0 966
8
2
8
0 1440
8
2
8
1 1440
8
0 857
8
2
8
0 796
8
2
8
0 406
8
2
8
1 406
8
0 1947
8
2
8
0 1118
8
2
8
1 1118
8
0 843
8
2
8
0 1587
8
2
8
0 1269
8
2
8
0 1742
8
...

result:

ok 

Test #71:

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

input:

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

output:

8
0 180
8
2
8
0 1935
8
2
8
0 1040
8
2
8
0 1206
8
2
8
0 1060
8
2
8
0 1188
8
2
8
0 1258
8
2
8
0 599
8
2
8
0 1504
8
2
8
1 1504
8
0 1043
8
2
8
1 1043
8
0 226
8
2
8
0 1477
8
2
8
0 1405
8
2
8
0 1796
8
2
8
1 1796
8
0 1491
8
2
8
0 1065
8
2
8
0 790
8
2
8
0 1319
8
2
8
0 1047
8
2
8
0 301
8
2
8
1 301
8
0 442
8
...

result:

ok 

Test #72:

score: 70.97
Acceptable Answer
time: 9ms
memory: 4020kb

input:

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

output:

8
0 180
8
2
8
0 1935
8
2
8
0 1040
8
2
8
0 1206
8
2
8
0 1060
8
2
8
0 1188
8
2
8
0 1258
8
2
8
0 599
8
2
8
0 1504
8
2
8
0 1043
8
2
8
0 226
8
2
8
0 1477
8
2
8
0 1405
8
2
8
0 1796
8
2
8
1 1796
8
0 1491
8
2
8
0 1065
8
2
8
1 1065
8
0 790
8
2
8
0 1319
8
2
8
0 1047
8
2
8
0 301
8
2
8
0 442
8
2
8
1 442
8
0 187...

result:

points 0.94626666670 points  0.94626666670

Test #73:

score: 71.34
Acceptable Answer
time: 9ms
memory: 4300kb

input:

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

output:

8
0 180
8
2
8
0 1935
8
2
8
0 1040
8
2
8
0 1206
8
2
8
0 1060
8
2
8
0 1188
8
2
8
0 1258
8
2
8
0 599
8
2
8
0 1504
8
2
8
0 1043
8
2
8
0 226
8
2
8
0 1477
8
2
8
0 1405
8
2
8
1 1405
8
0 1796
8
2
8
0 1491
8
2
8
0 1065
8
2
8
0 790
8
2
8
0 1319
8
2
8
0 1047
8
2
8
0 301
8
2
8
0 442
8
2
8
1 442
8
0 1878
8
2
8
0...

result:

points 0.95120 points  0.95120

Test #74:

score: 68.68
Acceptable Answer
time: 19ms
memory: 3964kb

input:

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

output:

8
0 180
8
2
8
0 1935
8
2
8
0 1040
8
2
8
0 1206
8
2
8
0 1060
8
2
8
0 1188
8
2
8
0 1258
8
2
8
0 599
8
2
8
0 1504
8
2
8
1 1504
8
0 1043
8
2
8
0 226
8
2
8
0 1477
8
2
8
0 1405
8
2
8
0 1796
8
2
8
0 1491
8
2
8
0 1065
8
2
8
0 790
8
2
8
0 1319
8
2
8
0 1047
8
2
8
0 301
8
2
8
0 442
8
2
8
1 442
8
0 1878
8
2
8
0...

result:

points 0.91573333330 points  0.91573333330

Test #75:

score: 68.75
Acceptable Answer
time: 4ms
memory: 4264kb

input:

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

output:

8
0 1899
8
2
8
0 1752
8
2
8
0 1281
8
2
8
0 664
8
2
8
0 599
8
2
8
0 744
8
2
8
0 1439
8
2
8
0 1502
8
2
8
0 1356
8
2
8
0 444
8
2
8
0 325
8
2
8
0 1052
8
2
8
0 1321
8
2
8
0 708
8
2
8
1 708
8
0 124
8
2
8
1 124
8
0 931
8
2
8
0 605
8
2
8
0 1533
8
2
8
1 1533
8
0 1289
8
2
8
0 824
8
2
8
1 824
8
0 592
8
2
8
1 5...

result:

points 0.91666666670 points  0.91666666670

Test #76:

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

input:

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

output:

8
0 1898
8
2
8
0 457
8
2
8
0 1395
8
2
8
0 147
8
2
8
0 598
8
2
8
0 135
8
2
8
0 1438
8
2
8
0 80
8
2
8
0 878
8
2
8
1 878
8
0 581
8
2
8
0 811
8
2
8
1 811
8
0 172
8
2
8
1 172
8
0 1320
8
2
8
0 659
8
2
8
0 1433
8
2
8
0 48
8
2
8
0 604
8
2
8
0 1532
8
2
8
0 1288
8
2
8
1 1288
8
0 654
8
2
8
1 654
8
0 1491
8
2
8...

result:

ok 

Test #77:

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

input:

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

output:

8
0 1898
8
2
8
0 457
8
2
8
0 1395
8
2
8
0 147
8
2
8
0 598
8
2
8
0 135
8
2
8
0 1438
8
2
8
0 80
8
2
8
0 878
8
2
8
0 581
8
2
8
1 581
8
0 811
8
2
8
0 172
8
2
8
0 1320
8
2
8
0 659
8
2
8
1 659
8
0 1433
8
2
8
0 48
8
2
8
0 604
8
2
8
0 1532
8
2
8
0 1288
8
2
8
0 654
8
2
8
1 654
8
0 1491
8
2
8
0 1811
8
2
8
0 1...

result:

ok 

Test #78:

score: 73.22
Acceptable Answer
time: 5ms
memory: 4084kb

input:

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

output:

8
0 997
8
2
8
0 1937
8
2
8
0 1524
8
2
8
1 1524
8
0 18
8
2
8
0 1032
8
2
8
0 196
8
2
8
0 1746
8
2
8
0 76
8
2
8
0 1501
8
2
8
0 1127
8
2
8
0 1603
8
2
8
0 1565
8
2
8
0 353
8
2
8
0 903
8
2
8
1 903
8
0 1131
8
2
8
1 1131
8
0 719
8
2
8
0 24
8
2
8
0 179
8
2
8
0 1242
8
2
8
0 892
8
2
8
0 816
8
2
8
1 816
8
0 253...

result:

points 0.97626666670 points  0.97626666670

Test #79:

score: 73.68
Acceptable Answer
time: 19ms
memory: 4020kb

input:

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

output:

8
0 997
8
2
8
0 1937
8
2
8
0 1524
8
2
8
1 1524
8
0 18
8
2
8
0 1032
8
2
8
0 196
8
2
8
0 1746
8
2
8
0 76
8
2
8
0 1501
8
2
8
0 1127
8
2
8
0 1603
8
2
8
0 1565
8
2
8
0 353
8
2
8
0 903
8
2
8
1 903
8
0 1131
8
2
8
1 1131
8
0 719
8
2
8
0 24
8
2
8
0 179
8
2
8
0 1242
8
2
8
0 892
8
2
8
0 816
8
2
8
1 816
8
0 253...

result:

points 0.98240 points  0.98240

Test #80:

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

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

output:

8
0 997
8
2
8
0 1937
8
2
8
0 1524
8
2
8
0 18
8
2
8
0 1032
8
2
8
0 196
8
2
8
0 1746
8
2
8
0 76
8
2
8
0 1501
8
2
8
0 1127
8
2
8
0 1603
8
2
8
0 1565
8
2
8
0 353
8
2
8
0 903
8
2
8
0 1131
8
2
8
0 719
8
2
8
0 24
8
2
8
0 179
8
2
8
0 1242
8
2
8
0 892
8
2
8
0 816
8
2
8
0 253
8
2
8
0 173
8
2
8
0 1262
8
2
8
0 ...

result:

ok 

Test #81:

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

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

output:

8
0 997
8
2
8
0 1937
8
2
8
0 1524
8
2
8
0 18
8
2
8
0 1032
8
2
8
0 196
8
2
8
0 1746
8
2
8
0 76
8
2
8
0 1501
8
2
8
0 1127
8
2
8
0 1603
8
2
8
0 1565
8
2
8
0 353
8
2
8
0 903
8
2
8
0 1131
8
2
8
0 719
8
2
8
0 24
8
2
8
0 179
8
2
8
0 1242
8
2
8
0 892
8
2
8
0 816
8
2
8
0 253
8
2
8
0 173
8
2
8
0 1262
8
2
8
0 ...

result:

ok 

Test #82:

score: 75
Accepted
time: 8ms
memory: 3976kb

input:

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

output:

8
0 1195
8
2
8
0 1776
8
2
8
0 200
8
2
8
0 1604
8
2
8
0 262
8
2
8
0 1819
8
2
8
0 326
8
2
8
0 814
8
2
8
0 590
8
2
8
0 563
8
2
8
1 563
8
0 1121
8
2
8
0 1205
8
2
8
0 1367
8
2
8
0 1686
8
2
8
0 1830
8
2
8
0 1100
8
2
8
1 1100
8
0 378
8
2
8
0 1895
8
2
8
0 198
8
2
8
1 198
8
0 333
8
2
8
1 333
8
0 1750
8
2
8
0...

result:

ok 

Test #83:

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

input:

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

output:

8
0 1195
8
2
8
0 1776
8
2
8
0 200
8
2
8
0 1604
8
2
8
0 262
8
2
8
0 1819
8
2
8
0 326
8
2
8
1 326
8
0 814
8
2
8
0 590
8
2
8
0 563
8
2
8
0 1121
8
2
8
0 1205
8
2
8
0 1367
8
2
8
0 1686
8
2
8
0 1830
8
2
8
0 1100
8
2
8
0 378
8
2
8
1 378
8
0 1895
8
2
8
0 198
8
2
8
0 333
8
2
8
0 1750
8
2
8
1 1750
8
0 522
8
2...

result:

ok 

Test #84:

score: 64.63
Acceptable Answer
time: 4ms
memory: 3940kb

input:

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

output:

8
0 536
8
2
8
0 330
8
2
8
1 330
8
0 200
8
2
8
1 200
8
0 244
8
2
8
1 244
8
0 262
8
2
8
1 262
8
0 261
8
2
8
1 261
8
0 326
8
2
8
1 326
8
0 143
8
2
8
1 143
8
0 34
8
2
8
1 34
8
0 91
8
2
8
1 91
8
0 431
8
2
8
1 431
8
0 352
8
2
8
1 352
8
0 538
8
2
8
0 342
8
2
8
1 342
8
0 256
8
2
8
1 256
8
0 250
8
2
8
1 250
...

result:

points 0.86173333330 points  0.86173333330

Test #85:

score: 57.15
Acceptable Answer
time: 13ms
memory: 4040kb

input:

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

output:

8
0 1195
8
2
8
0 1776
8
2
8
0 200
8
2
8
1 200
8
0 1604
8
2
8
1 1604
8
0 262
8
2
8
1 262
8
0 1819
8
2
8
1 1819
8
0 326
8
2
8
1 326
8
0 814
8
2
8
1 814
8
0 590
8
2
8
1 590
8
0 563
8
2
8
1 563
8
0 1121
8
2
8
0 1205
8
2
8
1 1205
8
0 1367
8
2
8
1 1367
8
0 1686
8
2
8
1 1686
8
0 1830
8
2
8
0 1100
8
2
8
1 1...

result:

points 0.7620 points  0.7620

Test #86:

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

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 782
8
2
8
0 522
8
2
8
0 1120
8
2
8
1 1120
8
0 1969
8
2
8
1 1969
8
0 1076
8
2
8
1 1076
8
0 1293
8
2
8
1 1293
8
0 1270
8
2
8
1 1270
8
0 85
8
2
8
1 85
8
0 1224
8
2
8
1 1224
8
0 1740
8
2
8
1 1740
8
0 1361
8
2
8
1 1361
8
0 1883
8
2
8
1 1883
8
0 1998
8
2
8
1 1998
8
0 1984
8
2
8
1 1984
8
0 1783
8
2
8
1...

result:

ok 

Test #87:

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

input:

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

output:

8
0 782
8
2
8
0 522
8
2
8
1 522
8
0 1120
8
2
8
0 1969
8
2
8
0 1076
8
2
8
0 1293
8
2
8
0 1270
8
2
8
0 85
8
2
8
1 85
8
0 1224
8
2
8
0 1740
8
2
8
0 1361
8
2
8
0 1883
8
2
8
0 1998
8
2
8
0 1984
8
2
8
0 1783
8
2
8
0 1320
8
2
8
0 894
8
2
8
1 894
8
0 687
8
2
8
1 687
8
0 1859
8
2
8
0 1929
8
2
8
0 1904
8
2
8
...

result:

ok 

Test #88:

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

input:

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

output:

8
0 782
8
2
8
0 522
8
2
8
0 1120
8
2
8
0 1969
8
2
8
1 1969
8
0 1076
8
2
8
1 1076
8
0 1293
8
2
8
1 1293
8
0 1270
8
2
8
1 1270
8
0 85
8
2
8
0 1224
8
2
8
1 1224
8
0 1740
8
2
8
1 1740
8
0 1361
8
2
8
1 1361
8
0 1883
8
2
8
1 1883
8
0 1998
8
2
8
1 1998
8
0 1984
8
2
8
1 1984
8
0 1783
8
2
8
1 1783
8
0 1320
8...

result:

ok 

Test #89:

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

input:

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

output:

8
0 782
8
2
8
0 522
8
2
8
0 1120
8
2
8
0 1969
8
2
8
0 1076
8
2
8
0 1293
8
2
8
0 1270
8
2
8
0 85
8
2
8
1 85
8
0 1224
8
2
8
0 1740
8
2
8
1 1740
8
0 1361
8
2
8
0 1883
8
2
8
1 1883
8
0 1998
8
2
8
1 1998
8
0 1984
8
2
8
1 1984
8
0 1783
8
2
8
1 1783
8
0 1320
8
2
8
0 894
8
2
8
0 687
8
2
8
0 1859
8
2
8
1 185...

result:

ok