QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#430083#4565. Rarest Insectsjames1BadCreeper#51.47 50ms4228kbC++171.8kb2024-06-03 13:42:212024-06-03 13:42:22

Judging History

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

  • [2024-06-03 13:42:22]
  • 评测
  • 测评结果:51.47
  • 用时:50ms
  • 内存:4228kb
  • [2024-06-03 13:42:21]
  • 提交

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; 
    shuffle(arr.begin(), arr.end(), Rand); 
    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
// 直接扫,

详细

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

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

output:

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

result:

ok 

Test #2:

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

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: 10
Accepted
time: 1ms
memory: 4192kb

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: 1ms
memory: 3932kb

input:

3
1
1
2
2

output:

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

result:

ok 

Test #5:

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

input:

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

output:

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

result:

ok 

Test #6:

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

input:

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

output:

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

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

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 129
8
2
8
0 64
8
2
8
1 64
8
0 153
8
2
8
1 153
8
0 154
8
2
8
1 154
8
0 109
8
2
8
1 109
8
0 133
8
2
8
1 133
8
0 162
8
2
8
1 162
8
0 149
8
2
8
1 149
8
0 114
8
2
8
1 114
8
0 147
8
2
8
1 147
8
0 91
8
2
8
1 91
8
0 50
8
2
8
1 50
8
0 95
8
2
8
1 95
8
0 135
8
2
8
1 135
8
0 137
8
2
8
1 137
8
0 117
8
2
8
1 ...

result:

ok 

Test #8:

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

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 128
8
2
8
0 153
8
2
8
0 152
8
2
8
0 87
8
2
8
0 108
8
2
8
0 132
8
2
8
0 23
8
2
8
0 148
8
2
8
0 47
8
2
8
0 146
8
2
8
0 121
8
2
8
0 8
8
2
8
0 94
8
2
8
0 134
8
2
8
0 136
8
2
8
0 116
8
2
8
0 186
8
2
8
0 125
8
2
8
0 62
8
2
8
0 160
8
2
8
0 77
8
2
8
0 81
8
2
8
0 122
8
2
8
0 123
8
2
8
0 69
8
2
8
0 189
8
...

result:

ok 

Test #9:

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

input:

200
1
2
1
1
1
1
1
1
2
1
2
1
2
2
2
1
2
2
1
2
2
1
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 128
8
2
8
0 153
8
2
8
1 153
8
0 152
8
2
8
0 87
8
2
8
0 108
8
2
8
0 132
8
2
8
0 23
8
2
8
0 148
8
2
8
0 47
8
2
8
1 47
8
0 146
8
2
8
0 121
8
2
8
1 121
8
0 8
8
2
8
0 94
8
2
8
1 94
8
0 134
8
2
8
1 134
8
0 136
8
2
8
1 136
8
0 116
8
2
8
0 186
8
2
8
1 186
8
0 125
8
2
8
1 125
8
0 62
8
2
8
0 160
8
2
8
1 1...

result:

ok 

Test #10:

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

input:

198
1
1
2
1
1
1
1
2
2
2
1
1
2
2
2
2
2
2
2
2
1
1
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 128
8
2
8
0 153
8
2
8
0 152
8
2
8
1 152
8
0 87
8
2
8
0 108
8
2
8
0 132
8
2
8
0 23
8
2
8
0 148
8
2
8
1 148
8
0 47
8
2
8
1 47
8
0 146
8
2
8
1 146
8
0 121
8
2
8
0 8
8
2
8
0 94
8
2
8
1 94
8
0 134
8
2
8
1 134
8
0 136
8
2
8
1 136
8
0 116
8
2
8
1 116
8
0 186
8
2
8
1 186
8
0 125
8
2
8
1 125
8
0 62
8
2
8...

result:

ok 

Test #11:

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

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

output:

8
0 129
8
2
8
0 64
8
2
8
1 64
8
0 153
8
2
8
1 153
8
0 154
8
2
8
1 154
8
0 109
8
2
8
1 109
8
0 133
8
2
8
1 133
8
0 162
8
2
8
1 162
8
0 149
8
2
8
1 149
8
0 114
8
2
8
1 114
8
0 147
8
2
8
1 147
8
0 91
8
2
8
1 91
8
0 50
8
2
8
1 50
8
0 95
8
2
8
1 95
8
0 135
8
2
8
1 135
8
0 137
8
2
8
1 137
8
0 117
8
2
8
1 ...

result:

ok 

Test #12:

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

input:

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

output:

8
0 129
8
2
8
0 64
8
2
8
0 153
8
2
8
0 154
8
2
8
0 109
8
2
8
0 133
8
2
8
0 162
8
2
8
0 149
8
2
8
1 149
8
0 114
8
2
8
1 114
8
0 147
8
2
8
1 147
8
0 91
8
2
8
1 91
8
0 50
8
2
8
1 50
8
0 95
8
2
8
0 135
8
2
8
1 135
8
0 137
8
2
8
1 137
8
0 117
8
2
8
0 187
8
2
8
1 187
8
0 8
8
2
8
0 36
8
2
8
0 120
8
2
8
1 1...

result:

ok 

Test #13:

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

input:

197
1
2
2
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 129
8
2
8
0 64
8
2
8
1 64
8
0 153
8
2
8
1 153
8
0 154
8
2
8
1 154
8
0 109
8
2
8
0 133
8
2
8
1 133
8
0 162
8
2
8
0 149
8
2
8
1 149
8
0 114
8
2
8
1 114
8
0 147
8
2
8
0 91
8
2
8
1 91
8
0 50
8
2
8
1 50
8
0 95
8
2
8
1 95
8
0 135
8
2
8
1 135
8
0 137
8
2
8
1 137
8
0 117
8
2
8
1 117
8
0 187
8
2
8
1 187
...

result:

ok 

Test #14:

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

input:

198
1
1
1
2
1
1
1
2
2
1
2
2
1
1
1
1
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
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 128
8
2
8
0 153
8
2
8
0 152
8
2
8
0 87
8
2
8
1 87
8
0 108
8
2
8
0 132
8
2
8
0 23
8
2
8
0 148
8
2
8
1 148
8
0 47
8
2
8
1 47
8
0 146
8
2
8
0 121
8
2
8
1 121
8
0 8
8
2
8
1 8
8
0 94
8
2
8
0 134
8
2
8
0 136
8
2
8
0 116
8
2
8
0 186
8
2
8
1 186
8
0 125
8
2
8
1 125
8
0 62
8
2
8
0 160
8
2
8
1 160
8
0 77
...

result:

ok 

Test #15:

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

input:

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

output:

8
0 128
8
2
8
0 153
8
2
8
0 152
8
2
8
0 87
8
2
8
0 108
8
2
8
1 108
8
0 132
8
2
8
1 132
8
0 23
8
2
8
1 23
8
0 148
8
2
8
1 148
8
0 47
8
2
8
1 47
8
0 146
8
2
8
0 121
8
2
8
1 121
8
0 8
8
2
8
1 8
8
0 94
8
2
8
1 94
8
0 134
8
2
8
1 134
8
0 136
8
2
8
1 136
8
0 116
8
2
8
1 116
8
0 186
8
2
8
1 186
8
0 125
8
2...

result:

ok 

Test #16:

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

input:

196
1
1
1
1
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 128
8
2
8
0 153
8
2
8
0 152
8
2
8
0 87
8
2
8
0 108
8
2
8
1 108
8
0 132
8
2
8
0 23
8
2
8
0 148
8
2
8
1 148
8
0 47
8
2
8
1 47
8
0 146
8
2
8
1 146
8
0 121
8
2
8
0 8
8
2
8
1 8
8
0 94
8
2
8
1 94
8
0 134
8
2
8
1 134
8
0 136
8
2
8
1 136
8
0 116
8
2
8
0 186
8
2
8
1 186
8
0 125
8
2
8
1 125
8
0 62
8
2
8
1...

result:

ok 

Test #17:

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

input:

199
1
1
1
1
1
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 129
8
2
8
0 64
8
2
8
0 153
8
2
8
0 154
8
2
8
0 109
8
2
8
0 133
8
2
8
0 162
8
2
8
0 149
8
2
8
1 149
8
0 114
8
2
8
1 114
8
0 147
8
2
8
0 91
8
2
8
1 91
8
0 50
8
2
8
1 50
8
0 95
8
2
8
1 95
8
0 135
8
2
8
1 135
8
0 137
8
2
8
1 137
8
0 117
8
2
8
1 117
8
0 187
8
2
8
1 187
8
0 8
8
2
8
1 8
8
0 36
8
2
8
0 ...

result:

ok 

Test #18:

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

input:

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

output:

8
0 128
8
2
8
0 153
8
2
8
0 152
8
2
8
0 87
8
2
8
0 108
8
2
8
0 132
8
2
8
1 132
8
0 23
8
2
8
1 23
8
0 148
8
2
8
0 47
8
2
8
0 146
8
2
8
1 146
8
0 121
8
2
8
1 121
8
0 8
8
2
8
0 94
8
2
8
1 94
8
0 134
8
2
8
0 136
8
2
8
0 116
8
2
8
1 116
8
0 186
8
2
8
1 186
8
0 125
8
2
8
1 125
8
0 62
8
2
8
1 62
8
0 160
8
...

result:

ok 

Test #19:

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

input:

196
1
1
2
1
1
1
1
2
1
2
1
1
1
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 128
8
2
8
0 153
8
2
8
0 152
8
2
8
1 152
8
0 87
8
2
8
0 108
8
2
8
0 132
8
2
8
0 23
8
2
8
0 148
8
2
8
1 148
8
0 47
8
2
8
0 146
8
2
8
1 146
8
0 121
8
2
8
0 8
8
2
8
0 94
8
2
8
0 134
8
2
8
1 134
8
0 136
8
2
8
1 136
8
0 116
8
2
8
1 116
8
0 186
8
2
8
0 125
8
2
8
1 125
8
0 62
8
2
8
1 62
8
0 160
8
2
8
1 ...

result:

ok 

Test #20:

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

input:

196
1
1
1
1
1
1
2
2
2
1
2
2
1
2
1
1
2
2
2
1
2
1
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 128
8
2
8
0 153
8
2
8
0 152
8
2
8
0 87
8
2
8
0 108
8
2
8
0 132
8
2
8
0 23
8
2
8
1 23
8
0 148
8
2
8
1 148
8
0 47
8
2
8
1 47
8
0 146
8
2
8
0 121
8
2
8
1 121
8
0 8
8
2
8
1 8
8
0 94
8
2
8
0 134
8
2
8
1 134
8
0 136
8
2
8
0 116
8
2
8
0 186
8
2
8
1 186
8
0 125
8
2
8
1 125
8
0 62
8
2
8
1 62
8
0 160
8
2
...

result:

ok 

Test #21:

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

input:

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

output:

8
0 128
8
2
8
0 153
8
2
8
0 152
8
2
8
0 87
8
2
8
0 108
8
2
8
0 132
8
2
8
0 23
8
2
8
0 148
8
2
8
1 148
8
0 47
8
2
8
1 47
8
0 146
8
2
8
0 121
8
2
8
0 8
8
2
8
0 94
8
2
8
0 134
8
2
8
0 136
8
2
8
0 116
8
2
8
0 186
8
2
8
0 125
8
2
8
0 62
8
2
8
0 160
8
2
8
1 160
8
0 77
8
2
8
0 81
8
2
8
0 122
8
2
8
0 123
8
...

result:

ok 

Test #22:

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

input:

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

output:

8
0 129
8
2
8
0 64
8
2
8
0 153
8
2
8
0 154
8
2
8
0 109
8
2
8
0 133
8
2
8
0 162
8
2
8
0 149
8
2
8
0 114
8
2
8
1 114
8
0 147
8
2
8
0 91
8
2
8
0 50
8
2
8
0 95
8
2
8
0 135
8
2
8
0 137
8
2
8
0 117
8
2
8
0 187
8
2
8
0 8
8
2
8
0 36
8
2
8
0 120
8
2
8
0 161
8
2
8
0 74
8
2
8
0 134
8
2
8
0 56
8
2
8
0 22
8
2
8
...

result:

ok 

Test #23:

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

input:

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

output:

8
0 128
8
2
8
0 153
8
2
8
0 152
8
2
8
0 87
8
2
8
0 108
8
2
8
0 132
8
2
8
0 23
8
2
8
0 148
8
2
8
0 47
8
2
8
0 146
8
2
8
0 121
8
2
8
0 8
8
2
8
0 94
8
2
8
0 134
8
2
8
0 136
8
2
8
0 116
8
2
8
0 186
8
2
8
0 125
8
2
8
0 62
8
2
8
0 160
8
2
8
0 77
8
2
8
0 81
8
2
8
0 122
8
2
8
0 123
8
2
8
0 69
8
2
8
0 189
8
...

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 401
8
2
8
0 497
8
2
8
1 497
8
0 329
8
2
8
1 329
8
0 632
8
2
8
1 632
8
0 468
8
2
8
1 468
8
0 465
8
2
8
1 465
8
0 927
8
2
8
1 927
8
0 481
8
2
8
1 481
8
0 870
8
2
8
1 870
8
0 444
8
2
8
1 444
8
0 518
8
2
8
1 518
8
0 693
8
2
8
1 693
8
0 578
8
2
8
1 578
8
0 363
8
2
8
1 363
8
0 136
8
2
8
1 136
8
0 767
...

result:

ok 

Test #25:

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

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 401
8
2
8
0 497
8
2
8
0 329
8
2
8
0 632
8
2
8
0 468
8
2
8
0 465
8
2
8
0 927
8
2
8
0 481
8
2
8
0 870
8
2
8
0 444
8
2
8
0 518
8
2
8
0 693
8
2
8
0 578
8
2
8
0 363
8
2
8
0 136
8
2
8
0 767
8
2
8
0 755
8
2
8
0 221
8
2
8
0 252
8
2
8
0 361
8
2
8
0 647
8
2
8
0 467
8
2
8
0 281
8
2
8
0 123
8
2
8
0 785
8
2
...

result:

ok 

Test #26:

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

input:

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

output:

8
0 558
8
2
8
0 904
8
2
8
0 394
8
2
8
0 633
8
2
8
0 469
8
2
8
0 358
8
2
8
0 407
8
2
8
0 404
8
2
8
0 871
8
2
8
0 606
8
2
8
0 519
8
2
8
0 663
8
2
8
1 663
8
0 579
8
2
8
0 260
8
2
8
0 212
8
2
8
0 936
8
2
8
0 350
8
2
8
0 454
8
2
8
1 454
8
0 482
8
2
8
0 530
8
2
8
1 530
8
0 438
8
2
8
1 438
8
0 74
8
2
8
1 7...

result:

ok 

Test #27:

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

input:

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

output:

8
0 987
8
2
8
0 928
8
2
8
0 318
8
2
8
0 783
8
2
8
0 216
8
2
8
0 838
8
2
8
0 183
8
2
8
0 511
8
2
8
0 29
8
2
8
0 807
8
2
8
1 807
8
0 330
8
2
8
1 330
8
0 802
8
2
8
0 329
8
2
8
0 604
8
2
8
0 579
8
2
8
1 579
8
0 368
8
2
8
0 494
8
2
8
0 827
8
2
8
0 786
8
2
8
0 611
8
2
8
0 487
8
2
8
1 487
8
0 693
8
2
8
1 6...

result:

ok 

Test #28:

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

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 988
8
2
8
0 343
8
2
8
1 343
8
0 671
8
2
8
1 671
8
0 784
8
2
8
1 784
8
0 173
8
2
8
1 173
8
0 40
8
2
8
1 40
8
0 377
8
2
8
1 377
8
0 683
8
2
8
1 683
8
0 605
8
2
8
1 605
8
0 808
8
2
8
1 808
8
0 811
8
2
8
1 811
8
0 588
8
2
8
1 588
8
0 316
8
2
8
1 316
8
0 286
8
2
8
1 286
8
0 578
8
2
8
1 578
8
0 84
8
2...

result:

ok 

Test #29:

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

input:

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

output:

8
0 987
8
2
8
0 928
8
2
8
0 318
8
2
8
1 318
8
0 783
8
2
8
0 216
8
2
8
1 216
8
0 838
8
2
8
0 183
8
2
8
1 183
8
0 511
8
2
8
0 29
8
2
8
0 807
8
2
8
1 807
8
0 330
8
2
8
1 330
8
0 802
8
2
8
1 802
8
0 329
8
2
8
1 329
8
0 604
8
2
8
0 579
8
2
8
1 579
8
0 368
8
2
8
1 368
8
0 494
8
2
8
0 827
8
2
8
1 827
8
0 7...

result:

ok 

Test #30:

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

input:

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

output:

8
0 988
8
2
8
0 343
8
2
8
0 671
8
2
8
0 784
8
2
8
1 784
8
0 173
8
2
8
0 40
8
2
8
1 40
8
0 377
8
2
8
1 377
8
0 683
8
2
8
0 605
8
2
8
1 605
8
0 808
8
2
8
1 808
8
0 811
8
2
8
1 811
8
0 588
8
2
8
1 588
8
0 316
8
2
8
1 316
8
0 286
8
2
8
1 286
8
0 578
8
2
8
1 578
8
0 84
8
2
8
1 84
8
0 849
8
2
8
1 849
8
0 ...

result:

ok 

Test #31:

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

input:

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

output:

8
0 554
8
2
8
0 453
8
2
8
0 682
8
2
8
0 590
8
2
8
0 516
8
2
8
0 795
8
2
8
1 795
8
0 341
8
2
8
0 389
8
2
8
0 125
8
2
8
0 347
8
2
8
0 804
8
2
8
1 804
8
0 745
8
2
8
0 652
8
2
8
0 676
8
2
8
0 29
8
2
8
0 634
8
2
8
0 734
8
2
8
0 500
8
2
8
0 342
8
2
8
1 342
8
0 535
8
2
8
0 681
8
2
8
1 681
8
0 429
8
2
8
0 6...

result:

ok 

Test #32:

score: 15
Accepted
time: 4ms
memory: 4212kb

input:

1000
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 554
8
2
8
0 453
8
2
8
0 682
8
2
8
1 682
8
0 590
8
2
8
0 516
8
2
8
1 516
8
0 795
8
2
8
1 795
8
0 341
8
2
8
1 341
8
0 389
8
2
8
0 125
8
2
8
1 125
8
0 347
8
2
8
1 347
8
0 804
8
2
8
1 804
8
0 745
8
2
8
1 745
8
0 652
8
2
8
0 676
8
2
8
1 676
8
0 29
8
2
8
1 29
8
0 634
8
2
8
1 634
8
0 734
8
2
8
1 734
8
...

result:

ok 

Test #33:

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

input:

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

output:

8
0 554
8
2
8
0 453
8
2
8
0 682
8
2
8
1 682
8
0 590
8
2
8
0 516
8
2
8
0 795
8
2
8
1 795
8
0 341
8
2
8
1 341
8
0 389
8
2
8
0 125
8
2
8
1 125
8
0 347
8
2
8
1 347
8
0 804
8
2
8
1 804
8
0 745
8
2
8
0 652
8
2
8
1 652
8
0 676
8
2
8
0 29
8
2
8
1 29
8
0 634
8
2
8
1 634
8
0 734
8
2
8
1 734
8
0 500
8
2
8
1 50...

result:

ok 

Test #34:

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

input:

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

output:

8
0 554
8
2
8
0 453
8
2
8
0 682
8
2
8
0 590
8
2
8
0 516
8
2
8
0 795
8
2
8
1 795
8
0 341
8
2
8
1 341
8
0 389
8
2
8
0 125
8
2
8
0 347
8
2
8
1 347
8
0 804
8
2
8
1 804
8
0 745
8
2
8
1 745
8
0 652
8
2
8
1 652
8
0 676
8
2
8
1 676
8
0 29
8
2
8
0 634
8
2
8
0 734
8
2
8
1 734
8
0 500
8
2
8
1 500
8
0 342
8
2
8...

result:

ok 

Test #35:

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

input:

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

output:

8
0 554
8
2
8
0 453
8
2
8
0 682
8
2
8
1 682
8
0 590
8
2
8
0 516
8
2
8
0 795
8
2
8
0 341
8
2
8
1 341
8
0 389
8
2
8
0 125
8
2
8
0 347
8
2
8
0 804
8
2
8
1 804
8
0 745
8
2
8
1 745
8
0 652
8
2
8
0 676
8
2
8
1 676
8
0 29
8
2
8
0 634
8
2
8
1 634
8
0 734
8
2
8
1 734
8
0 500
8
2
8
1 500
8
0 342
8
2
8
1 342
8...

result:

ok 

Test #36:

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

input:

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

output:

8
0 555
8
2
8
0 832
8
2
8
0 683
8
2
8
0 591
8
2
8
0 517
8
2
8
0 5
8
2
8
0 524
8
2
8
0 458
8
2
8
0 940
8
2
8
1 940
8
0 410
8
2
8
1 410
8
0 805
8
2
8
1 805
8
0 176
8
2
8
1 176
8
0 653
8
2
8
1 653
8
0 677
8
2
8
1 677
8
0 852
8
2
8
1 852
8
0 635
8
2
8
1 635
8
0 735
8
2
8
1 735
8
0 501
8
2
8
1 501
8
0 34...

result:

ok 

Test #37:

score: 15
Accepted
time: 25ms
memory: 3920kb

input:

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

output:

8
0 220
8
2
8
0 69
8
2
8
0 734
8
2
8
0 828
8
2
8
1 828
8
0 516
8
2
8
0 887
8
2
8
0 864
8
2
8
0 913
8
2
8
1 913
8
0 896
8
2
8
1 896
8
0 781
8
2
8
1 781
8
0 226
8
2
8
0 591
8
2
8
0 677
8
2
8
1 677
8
0 20
8
2
8
1 20
8
0 381
8
2
8
1 381
8
0 451
8
2
8
1 451
8
0 795
8
2
8
0 834
8
2
8
0 888
8
2
8
1 888
8
0...

result:

ok 

Test #38:

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

input:

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

output:

8
0 220
8
2
8
0 69
8
2
8
0 734
8
2
8
0 828
8
2
8
0 516
8
2
8
0 887
8
2
8
0 864
8
2
8
0 913
8
2
8
0 896
8
2
8
1 896
8
0 781
8
2
8
0 226
8
2
8
1 226
8
0 591
8
2
8
0 677
8
2
8
1 677
8
0 20
8
2
8
0 381
8
2
8
1 381
8
0 451
8
2
8
0 795
8
2
8
0 834
8
2
8
0 888
8
2
8
0 971
8
2
8
1 971
8
0 951
8
2
8
0 150
8
...

result:

ok 

Test #39:

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

input:

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

output:

8
0 220
8
2
8
0 69
8
2
8
0 734
8
2
8
0 828
8
2
8
0 516
8
2
8
0 887
8
2
8
0 864
8
2
8
0 913
8
2
8
0 896
8
2
8
0 781
8
2
8
0 226
8
2
8
0 591
8
2
8
0 677
8
2
8
0 20
8
2
8
0 381
8
2
8
0 451
8
2
8
0 795
8
2
8
0 834
8
2
8
1 834
8
0 888
8
2
8
0 971
8
2
8
0 951
8
2
8
0 150
8
2
8
0 171
8
2
8
0 28
8
2
8
1 28
...

result:

ok 

Test #40:

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

input:

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

output:

8
0 903
8
2
8
0 713
8
2
8
0 636
8
2
8
0 406
8
2
8
0 93
8
2
8
0 886
8
2
8
0 437
8
2
8
0 912
8
2
8
0 44
8
2
8
0 780
8
2
8
0 367
8
2
8
0 590
8
2
8
0 676
8
2
8
0 887
8
2
8
0 465
8
2
8
0 689
8
2
8
0 794
8
2
8
0 192
8
2
8
0 670
8
2
8
0 970
8
2
8
0 950
8
2
8
1 950
8
0 86
8
2
8
0 170
8
2
8
0 487
8
2
8
0 523...

result:

ok 

Test #41:

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

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

output:

8
0 220
8
2
8
0 69
8
2
8
0 734
8
2
8
0 828
8
2
8
0 516
8
2
8
0 887
8
2
8
0 864
8
2
8
0 913
8
2
8
0 896
8
2
8
0 781
8
2
8
0 226
8
2
8
0 591
8
2
8
0 677
8
2
8
0 20
8
2
8
0 381
8
2
8
0 451
8
2
8
0 795
8
2
8
0 834
8
2
8
0 888
8
2
8
0 971
8
2
8
0 951
8
2
8
0 150
8
2
8
0 171
8
2
8
0 28
8
2
8
0 436
8
2
8
0...

result:

ok 

Test #42:

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

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

output:

8
0 220
8
2
8
0 69
8
2
8
0 734
8
2
8
0 828
8
2
8
0 516
8
2
8
0 887
8
2
8
0 864
8
2
8
0 913
8
2
8
0 896
8
2
8
0 781
8
2
8
0 226
8
2
8
0 591
8
2
8
0 677
8
2
8
0 20
8
2
8
0 381
8
2
8
0 451
8
2
8
0 795
8
2
8
0 834
8
2
8
0 888
8
2
8
0 971
8
2
8
0 951
8
2
8
0 150
8
2
8
0 171
8
2
8
0 28
8
2
8
0 436
8
2
8
0...

result:

ok 

Subtask #3:

score: 26.47
Acceptable Answer

Test #43:

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

input:

2
1
2
2
2

output:

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

result:

ok 

Test #44:

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

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

input:

3
1
1
2
2

output:

8
0 0
8
2
8
0 2
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: 3892kb

input:

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

output:

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

result:

ok 

Test #47:

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

input:

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

output:

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

result:

ok 

Test #48:

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

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 1441
8
2
8
0 1254
8
2
8
1 1254
8
0 1146
8
2
8
1 1146
8
0 1767
8
2
8
1 1767
8
0 318
8
2
8
1 318
8
0 565
8
2
8
1 565
8
0 675
8
2
8
1 675
8
0 1624
8
2
8
1 1624
8
0 1809
8
2
8
1 1809
8
0 454
8
2
8
1 454
8
0 281
8
2
8
1 281
8
0 276
8
2
8
1 276
8
0 143
8
2
8
1 143
8
0 442
8
2
8
1 442
8
0 1124
8
2
8
1 ...

result:

ok 

Test #49:

score: 75
Accepted
time: 7ms
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 1441
8
2
8
0 1254
8
2
8
0 1146
8
2
8
0 1767
8
2
8
0 318
8
2
8
0 565
8
2
8
0 675
8
2
8
0 1624
8
2
8
0 1809
8
2
8
0 454
8
2
8
0 281
8
2
8
0 276
8
2
8
0 143
8
2
8
0 442
8
2
8
0 1124
8
2
8
0 1129
8
2
8
0 988
8
2
8
0 800
8
2
8
0 1840
8
2
8
0 1030
8
2
8
0 1691
8
2
8
0 1042
8
2
8
0 1
8
2
8
0 834
8
2
8
...

result:

ok 

Test #50:

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

input:

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

output:

8
0 1441
8
2
8
0 1254
8
2
8
0 1146
8
2
8
0 1767
8
2
8
0 318
8
2
8
0 565
8
2
8
0 675
8
2
8
0 1624
8
2
8
0 1809
8
2
8
0 454
8
2
8
1 454
8
0 281
8
2
8
0 276
8
2
8
0 143
8
2
8
1 143
8
0 442
8
2
8
0 1124
8
2
8
1 1124
8
0 1129
8
2
8
0 988
8
2
8
0 800
8
2
8
0 1840
8
2
8
1 1840
8
0 1030
8
2
8
0 1691
8
2
8
1...

result:

ok 

Test #51:

score: 70.77
Acceptable Answer
time: 6ms
memory: 3996kb

input:

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

output:

8
0 1441
8
2
8
0 1254
8
2
8
0 1146
8
2
8
0 1767
8
2
8
0 318
8
2
8
0 565
8
2
8
1 565
8
0 675
8
2
8
0 1624
8
2
8
1 1624
8
0 1809
8
2
8
0 454
8
2
8
0 281
8
2
8
0 276
8
2
8
0 143
8
2
8
1 143
8
0 442
8
2
8
0 1124
8
2
8
1 1124
8
0 1129
8
2
8
0 988
8
2
8
0 800
8
2
8
0 1840
8
2
8
1 1840
8
0 1030
8
2
8
0 169...

result:

points 0.94360 points  0.94360

Test #52:

score: 26.47
Acceptable Answer
time: 50ms
memory: 4008kb

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 195
8
2
8
0 1315
8
2
8
1 1315
8
0 1031
8
2
8
1 1031
8
0 163
8
2
8
1 163
8
0 1561
8
2
8
1 1561
8
0 1415
8
2
8
1 1415
8
0 1488
8
2
8
1 1488
8
0 922
8
2
8
1 922
8
0 1076
8
2
8
1 1076
8
0 151
8
2
8
1 151
8
0 1534
8
2
8
1 1534
8
0 627
8
2
8
1 627
8
0 795
8
2
8
1 795
8
0 1724
8
2
8
1 1724
8
0 909
8
2
...

result:

points 0.35293333330 points  0.35293333330

Test #53:

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

input:

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

output:

8
0 195
8
2
8
0 1315
8
2
8
0 1031
8
2
8
0 163
8
2
8
0 1561
8
2
8
0 1415
8
2
8
0 1488
8
2
8
1 1488
8
0 922
8
2
8
0 1076
8
2
8
0 151
8
2
8
0 1534
8
2
8
1 1534
8
0 627
8
2
8
0 795
8
2
8
1 795
8
0 1724
8
2
8
0 909
8
2
8
0 300
8
2
8
0 998
8
2
8
0 1419
8
2
8
0 233
8
2
8
0 1599
8
2
8
0 1175
8
2
8
0 1980
8
...

result:

ok 

Test #54:

score: 28.88
Acceptable Answer
time: 47ms
memory: 4220kb

input:

2000
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 212
8
2
8
0 1982
8
2
8
0 28
8
2
8
0 257
8
2
8
1 257
8
0 710
8
2
8
0 1017
8
2
8
1 1017
8
0 449
8
2
8
1 449
8
0 1386
8
2
8
1 1386
8
0 950
8
2
8
1 950
8
0 1760
8
2
8
1 1760
8
0 1764
8
2
8
1 1764
8
0 1615
8
2
8
1 1615
8
0 1882
8
2
8
1 1882
8
0 1793
8
2
8
1 1793
8
0 93
8
2
8
1 93
8
0 844
8
2
8
1 844
...

result:

points 0.38506666670 points  0.38506666670

Test #55:

score: 58
Acceptable Answer
time: 22ms
memory: 4224kb

input:

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

output:

8
0 1186
8
2
8
0 1530
8
2
8
0 1461
8
2
8
0 473
8
2
8
0 1639
8
2
8
0 1913
8
2
8
0 433
8
2
8
0 377
8
2
8
0 308
8
2
8
0 1710
8
2
8
0 1932
8
2
8
0 1374
8
2
8
0 1548
8
2
8
0 1750
8
2
8
0 1919
8
2
8
0 939
8
2
8
0 1967
8
2
8
0 1261
8
2
8
1 1261
8
0 52
8
2
8
0 645
8
2
8
0 21
8
2
8
0 1621
8
2
8
1 1621
8
0 16...

result:

points 0.77333333330 points  0.77333333330

Test #56:

score: 74.58
Acceptable Answer
time: 4ms
memory: 3928kb

input:

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

output:

8
0 1186
8
2
8
0 1530
8
2
8
0 1461
8
2
8
1 1461
8
0 473
8
2
8
0 1639
8
2
8
1 1639
8
0 1913
8
2
8
0 433
8
2
8
0 377
8
2
8
1 377
8
0 308
8
2
8
1 308
8
0 1710
8
2
8
1 1710
8
0 1932
8
2
8
1 1932
8
0 1374
8
2
8
1 1374
8
0 1548
8
2
8
1 1548
8
0 1750
8
2
8
1 1750
8
0 1919
8
2
8
1 1919
8
0 939
8
2
8
1 939
8...

result:

points 0.99440 points  0.99440

Test #57:

score: 74.52
Acceptable Answer
time: 4ms
memory: 3900kb

input:

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

output:

8
0 1187
8
2
8
0 1531
8
2
8
1 1531
8
0 56
8
2
8
0 828
8
2
8
0 1654
8
2
8
0 1225
8
2
8
0 1998
8
2
8
1 1998
8
0 398
8
2
8
0 1454
8
2
8
0 1846
8
2
8
1 1846
8
0 1935
8
2
8
1 1935
8
0 1375
8
2
8
1 1375
8
0 1549
8
2
8
1 1549
8
0 1751
8
2
8
1 1751
8
0 431
8
2
8
1 431
8
0 494
8
2
8
1 494
8
0 336
8
2
8
1 336...

result:

points 0.99360 points  0.99360

Test #58:

score: 73.64
Acceptable Answer
time: 10ms
memory: 3868kb

input:

1997
1
1
1
1
2
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1798
8
2
8
0 541
8
2
8
0 1527
8
2
8
0 1485
8
2
8
0 1920
8
2
8
1 1920
8
0 790
8
2
8
1 790
8
0 1592
8
2
8
0 1004
8
2
8
1 1004
8
0 149
8
2
8
1 149
8
0 734
8
2
8
1 734
8
0 652
8
2
8
1 652
8
0 625
8
2
8
0 1878
8
2
8
0 1083
8
2
8
1 1083
8
0 141
8
2
8
0 1655
8
2
8
1 1655
8
0 1744
8
2
8
1 1744
8
0 335
8...

result:

points 0.98186666670 points  0.98186666670

Test #59:

score: 72.84
Acceptable Answer
time: 0ms
memory: 4004kb

input:

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

output:

8
0 496
8
2
8
0 599
8
2
8
0 1526
8
2
8
0 1805
8
2
8
1 1805
8
0 1852
8
2
8
0 1079
8
2
8
1 1079
8
0 167
8
2
8
0 945
8
2
8
1 945
8
0 895
8
2
8
0 313
8
2
8
0 1039
8
2
8
1 1039
8
0 1181
8
2
8
1 1181
8
0 1831
8
2
8
1 1831
8
0 1082
8
2
8
1 1082
8
0 140
8
2
8
0 1652
8
2
8
1 1652
8
0 977
8
2
8
0 334
8
2
8
1 ...

result:

points 0.97120 points  0.97120

Test #60:

score: 72.3
Acceptable Answer
time: 9ms
memory: 3920kb

input:

1996
1
1
1
1
2
2
1
1
2
1
2
2
1
1
1
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 496
8
2
8
0 599
8
2
8
0 1526
8
2
8
0 1805
8
2
8
0 1852
8
2
8
1 1852
8
0 1079
8
2
8
1 1079
8
0 167
8
2
8
0 945
8
2
8
0 895
8
2
8
1 895
8
0 313
8
2
8
0 1039
8
2
8
1 1039
8
0 1181
8
2
8
1 1181
8
0 1831
8
2
8
0 1082
8
2
8
0 140
8
2
8
0 1652
8
2
8
1 1652
8
0 977
8
2
8
1 977
8
0 334
8
2
8
1 334
8
0 16...

result:

points 0.9640 points  0.9640

Test #61:

score: 72.85
Acceptable Answer
time: 17ms
memory: 3956kb

input:

2000
1
2
1
1
1
1
1
1
2
1
1
1
1
2
2
2
2
2
2
2
1
1
2
1
2
2
1
2
2
2
1
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
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1533
8
2
8
0 795
8
2
8
1 795
8
0 965
8
2
8
0 409
8
2
8
0 1904
8
2
8
0 1373
8
2
8
0 55
8
2
8
0 857
8
2
8
0 773
8
2
8
1 773
8
0 868
8
2
8
0 307
8
2
8
0 940
8
2
8
0 1012
8
2
8
0 630
8
2
8
1 630
8
0 1829
8
2
8
1 1829
8
0 608
8
2
8
1 608
8
0 376
8
2
8
1 376
8
0 1283
8
2
8
1 1283
8
0 1871
8
2
8
1 1871...

result:

points 0.97133333330 points  0.97133333330

Test #62:

score: 70.77
Acceptable Answer
time: 21ms
memory: 4216kb

input:

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

output:

8
0 1533
8
2
8
0 795
8
2
8
0 965
8
2
8
0 409
8
2
8
1 409
8
0 1904
8
2
8
0 1373
8
2
8
0 55
8
2
8
1 55
8
0 857
8
2
8
0 773
8
2
8
0 868
8
2
8
0 307
8
2
8
1 307
8
0 940
8
2
8
0 1012
8
2
8
0 630
8
2
8
0 1829
8
2
8
0 608
8
2
8
1 608
8
0 376
8
2
8
0 1283
8
2
8
0 1871
8
2
8
0 377
8
2
8
1 377
8
0 1219
8
2
8
...

result:

points 0.94360 points  0.94360

Test #63:

score: 73.09
Acceptable Answer
time: 21ms
memory: 3924kb

input:

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

output:

8
0 1533
8
2
8
0 795
8
2
8
0 965
8
2
8
0 409
8
2
8
0 1904
8
2
8
0 1373
8
2
8
0 55
8
2
8
0 857
8
2
8
0 773
8
2
8
0 868
8
2
8
0 307
8
2
8
0 940
8
2
8
1 940
8
0 1012
8
2
8
0 630
8
2
8
0 1829
8
2
8
0 608
8
2
8
0 376
8
2
8
0 1283
8
2
8
0 1871
8
2
8
1 1871
8
0 377
8
2
8
0 1219
8
2
8
1 1219
8
0 39
8
2
8
0 ...

result:

points 0.97453333330 points  0.97453333330

Test #64:

score: 71.9
Acceptable Answer
time: 4ms
memory: 3884kb

input:

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

output:

8
0 1641
8
2
8
0 879
8
2
8
0 1917
8
2
8
0 624
8
2
8
0 1577
8
2
8
0 187
8
2
8
0 1993
8
2
8
0 1089
8
2
8
0 34
8
2
8
0 1141
8
2
8
1 1141
8
0 741
8
2
8
0 1872
8
2
8
0 813
8
2
8
0 1018
8
2
8
0 1546
8
2
8
0 326
8
2
8
0 304
8
2
8
0 908
8
2
8
0 743
8
2
8
0 1717
8
2
8
0 510
8
2
8
0 615
8
2
8
0 229
8
2
8
0 12...

result:

points 0.95866666670 points  0.95866666670

Test #65:

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

input:

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

output:

8
0 1641
8
2
8
0 879
8
2
8
0 1917
8
2
8
0 624
8
2
8
0 1577
8
2
8
0 187
8
2
8
1 187
8
0 1993
8
2
8
0 1089
8
2
8
0 34
8
2
8
0 1141
8
2
8
0 741
8
2
8
0 1872
8
2
8
0 813
8
2
8
0 1018
8
2
8
0 1546
8
2
8
0 326
8
2
8
0 304
8
2
8
0 908
8
2
8
0 743
8
2
8
0 1717
8
2
8
0 510
8
2
8
0 615
8
2
8
0 229
8
2
8
0 121...

result:

ok 

Test #66:

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

input:

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

output:

8
0 1640
8
2
8
0 878
8
2
8
0 1939
8
2
8
1 1939
8
0 1851
8
2
8
0 1576
8
2
8
0 561
8
2
8
0 1992
8
2
8
0 1705
8
2
8
0 735
8
2
8
0 1140
8
2
8
0 740
8
2
8
0 774
8
2
8
0 1607
8
2
8
1 1607
8
0 108
8
2
8
0 1775
8
2
8
0 1873
8
2
8
0 1401
8
2
8
0 849
8
2
8
0 799
8
2
8
0 1716
8
2
8
0 1247
8
2
8
0 1067
8
2
8
0 ...

result:

ok 

Test #67:

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

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

output:

8
0 1641
8
2
8
0 879
8
2
8
0 1917
8
2
8
0 624
8
2
8
0 1577
8
2
8
0 187
8
2
8
0 1993
8
2
8
0 1089
8
2
8
0 34
8
2
8
0 1141
8
2
8
0 741
8
2
8
0 1872
8
2
8
0 813
8
2
8
0 1018
8
2
8
0 1546
8
2
8
0 326
8
2
8
0 304
8
2
8
0 908
8
2
8
0 743
8
2
8
0 1717
8
2
8
0 510
8
2
8
0 615
8
2
8
0 229
8
2
8
0 1212
8
2
8
...

result:

ok 

Test #68:

score: 74.76
Acceptable Answer
time: 3ms
memory: 3928kb

input:

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

output:

8
0 619
8
2
8
0 1772
8
2
8
0 1744
8
2
8
0 1384
8
2
8
0 1742
8
2
8
0 1559
8
2
8
0 1070
8
2
8
0 454
8
2
8
0 1053
8
2
8
0 1891
8
2
8
0 1152
8
2
8
1 1152
8
0 1634
8
2
8
1 1634
8
0 1043
8
2
8
0 1217
8
2
8
0 284
8
2
8
0 959
8
2
8
0 429
8
2
8
0 769
8
2
8
1 769
8
0 1832
8
2
8
1 1832
8
0 437
8
2
8
0 905
8
2
...

result:

points 0.99680 points  0.99680

Test #69:

score: 74.76
Acceptable Answer
time: 11ms
memory: 3984kb

input:

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

output:

8
0 619
8
2
8
0 1772
8
2
8
0 1744
8
2
8
0 1384
8
2
8
0 1742
8
2
8
0 1559
8
2
8
0 1070
8
2
8
0 454
8
2
8
0 1053
8
2
8
0 1891
8
2
8
0 1152
8
2
8
1 1152
8
0 1634
8
2
8
1 1634
8
0 1043
8
2
8
0 1217
8
2
8
0 284
8
2
8
0 959
8
2
8
0 429
8
2
8
0 769
8
2
8
1 769
8
0 1832
8
2
8
1 1832
8
0 437
8
2
8
0 905
8
2
...

result:

points 0.99680 points  0.99680

Test #70:

score: 74.89
Acceptable Answer
time: 12ms
memory: 4216kb

input:

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

output:

8
0 619
8
2
8
0 1772
8
2
8
0 1744
8
2
8
0 1384
8
2
8
0 1742
8
2
8
0 1559
8
2
8
0 1070
8
2
8
0 454
8
2
8
0 1053
8
2
8
0 1891
8
2
8
0 1152
8
2
8
1 1152
8
0 1634
8
2
8
1 1634
8
0 1043
8
2
8
0 1217
8
2
8
1 1217
8
0 284
8
2
8
0 959
8
2
8
1 959
8
0 429
8
2
8
1 429
8
0 769
8
2
8
0 1832
8
2
8
0 437
8
2
8
1 ...

result:

points 0.99853333330 points  0.99853333330

Test #71:

score: 74.89
Acceptable Answer
time: 9ms
memory: 3920kb

input:

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

output:

8
0 619
8
2
8
0 1772
8
2
8
0 1744
8
2
8
0 1384
8
2
8
0 1742
8
2
8
0 1559
8
2
8
0 1070
8
2
8
0 454
8
2
8
0 1053
8
2
8
0 1891
8
2
8
0 1152
8
2
8
1 1152
8
0 1634
8
2
8
1 1634
8
0 1043
8
2
8
0 1217
8
2
8
1 1217
8
0 284
8
2
8
0 959
8
2
8
1 959
8
0 429
8
2
8
1 429
8
0 769
8
2
8
0 1832
8
2
8
0 437
8
2
8
1 ...

result:

points 0.99853333330 points  0.99853333330

Test #72:

score: 70.84
Acceptable Answer
time: 9ms
memory: 3828kb

input:

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

output:

8
0 1922
8
2
8
0 126
8
2
8
0 307
8
2
8
0 1683
8
2
8
0 237
8
2
8
0 1590
8
2
8
0 255
8
2
8
0 1409
8
2
8
0 96
8
2
8
0 966
8
2
8
0 864
8
2
8
0 1071
8
2
8
0 948
8
2
8
0 1128
8
2
8
0 430
8
2
8
0 473
8
2
8
1 473
8
0 426
8
2
8
0 884
8
2
8
0 1974
8
2
8
0 767
8
2
8
0 1597
8
2
8
1 1597
8
0 1442
8
2
8
0 1006
8
...

result:

points 0.94453333330 points  0.94453333330

Test #73:

score: 70.84
Acceptable Answer
time: 15ms
memory: 3916kb

input:

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

output:

8
0 1922
8
2
8
0 126
8
2
8
0 307
8
2
8
0 1683
8
2
8
0 237
8
2
8
0 1590
8
2
8
0 255
8
2
8
0 1409
8
2
8
0 96
8
2
8
0 966
8
2
8
0 864
8
2
8
0 1071
8
2
8
0 948
8
2
8
0 1128
8
2
8
0 430
8
2
8
0 473
8
2
8
0 426
8
2
8
0 884
8
2
8
1 884
8
0 1974
8
2
8
0 767
8
2
8
0 1597
8
2
8
1 1597
8
0 1442
8
2
8
0 1006
8
...

result:

points 0.94453333330 points  0.94453333330

Test #74:

score: 66.26
Acceptable Answer
time: 10ms
memory: 3944kb

input:

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

output:

8
0 1922
8
2
8
0 126
8
2
8
0 1986
8
2
8
0 1683
8
2
8
0 237
8
2
8
0 1590
8
2
8
0 255
8
2
8
0 1409
8
2
8
0 96
8
2
8
0 966
8
2
8
0 864
8
2
8
0 1071
8
2
8
0 948
8
2
8
0 1128
8
2
8
0 430
8
2
8
1 430
8
0 473
8
2
8
0 426
8
2
8
0 884
8
2
8
0 1974
8
2
8
0 767
8
2
8
0 1597
8
2
8
0 1442
8
2
8
0 1006
8
2
8
1 10...

result:

points 0.88346666670 points  0.88346666670

Test #75:

score: 66.26
Acceptable Answer
time: 0ms
memory: 4228kb

input:

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

output:

8
0 1481
8
2
8
0 737
8
2
8
0 827
8
2
8
0 964
8
2
8
0 1634
8
2
8
0 1365
8
2
8
1 1365
8
0 17
8
2
8
0 288
8
2
8
0 354
8
2
8
0 1470
8
2
8
0 255
8
2
8
0 765
8
2
8
0 1509
8
2
8
0 1670
8
2
8
0 312
8
2
8
0 752
8
2
8
1 752
8
0 648
8
2
8
0 1386
8
2
8
0 943
8
2
8
1 943
8
0 1663
8
2
8
0 1385
8
2
8
0 1601
8
2
8
...

result:

points 0.88346666670 points  0.88346666670

Test #76:

score: 74.9
Acceptable Answer
time: 6ms
memory: 3924kb

input:

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

output:

8
0 1482
8
2
8
0 999
8
2
8
0 826
8
2
8
0 350
8
2
8
0 110
8
2
8
0 1364
8
2
8
1 1364
8
0 385
8
2
8
0 1703
8
2
8
0 52
8
2
8
0 944
8
2
8
0 705
8
2
8
0 1525
8
2
8
1 1525
8
0 1510
8
2
8
1 1510
8
0 172
8
2
8
0 75
8
2
8
0 303
8
2
8
1 303
8
0 1157
8
2
8
0 552
8
2
8
0 1111
8
2
8
1 1111
8
0 1664
8
2
8
0 1339
8...

result:

points 0.99866666670 points  0.99866666670

Test #77:

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

input:

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

output:

8
0 1482
8
2
8
0 999
8
2
8
0 826
8
2
8
0 350
8
2
8
0 110
8
2
8
0 1364
8
2
8
0 385
8
2
8
0 1703
8
2
8
0 52
8
2
8
0 944
8
2
8
0 705
8
2
8
0 1525
8
2
8
1 1525
8
0 1510
8
2
8
1 1510
8
0 172
8
2
8
0 75
8
2
8
0 303
8
2
8
1 303
8
0 1157
8
2
8
0 552
8
2
8
0 1111
8
2
8
1 1111
8
0 1664
8
2
8
1 1664
8
0 1339
8...

result:

points 0.99866666670 points  0.99866666670

Test #78:

score: 70.83
Acceptable Answer
time: 0ms
memory: 3952kb

input:

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

output:

8
0 881
8
2
8
0 1569
8
2
8
0 1240
8
2
8
0 603
8
2
8
0 1389
8
2
8
0 533
8
2
8
0 233
8
2
8
0 633
8
2
8
0 1726
8
2
8
0 382
8
2
8
0 1835
8
2
8
0 962
8
2
8
0 746
8
2
8
0 1319
8
2
8
0 1775
8
2
8
0 618
8
2
8
1 618
8
0 895
8
2
8
0 450
8
2
8
0 1405
8
2
8
0 31
8
2
8
0 57
8
2
8
0 312
8
2
8
0 266
8
2
8
0 445
8
...

result:

points 0.94440 points  0.94440

Test #79:

score: 70.83
Acceptable Answer
time: 11ms
memory: 3896kb

input:

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

output:

8
0 881
8
2
8
0 1569
8
2
8
0 1240
8
2
8
0 603
8
2
8
0 1389
8
2
8
0 533
8
2
8
0 233
8
2
8
0 633
8
2
8
0 1726
8
2
8
0 382
8
2
8
0 1835
8
2
8
0 962
8
2
8
0 746
8
2
8
0 1319
8
2
8
0 1775
8
2
8
0 618
8
2
8
1 618
8
0 895
8
2
8
0 450
8
2
8
0 1405
8
2
8
0 31
8
2
8
0 57
8
2
8
0 312
8
2
8
0 266
8
2
8
0 445
8
...

result:

points 0.94440 points  0.94440

Test #80:

score: 74.8
Acceptable Answer
time: 11ms
memory: 3896kb

input:

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

output:

8
0 881
8
2
8
0 1569
8
2
8
0 1240
8
2
8
0 603
8
2
8
0 1389
8
2
8
0 533
8
2
8
0 233
8
2
8
0 633
8
2
8
1 633
8
0 1726
8
2
8
0 382
8
2
8
0 1835
8
2
8
0 962
8
2
8
0 746
8
2
8
0 1319
8
2
8
0 1775
8
2
8
0 618
8
2
8
0 895
8
2
8
0 450
8
2
8
0 1405
8
2
8
0 31
8
2
8
1 31
8
0 57
8
2
8
0 312
8
2
8
0 266
8
2
8
1...

result:

points 0.99733333330 points  0.99733333330

Test #81:

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

input:

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

output:

8
0 1675
8
2
8
0 223
8
2
8
0 978
8
2
8
0 1412
8
2
8
0 177
8
2
8
0 7
8
2
8
0 1346
8
2
8
0 1909
8
2
8
1 1909
8
0 1803
8
2
8
0 1055
8
2
8
0 59
8
2
8
1 59
8
0 965
8
2
8
0 1985
8
2
8
0 1436
8
2
8
0 1177
8
2
8
0 488
8
2
8
0 197
8
2
8
0 1756
8
2
8
0 1847
8
2
8
0 1855
8
2
8
0 915
8
2
8
0 411
8
2
8
1 411
8
0...

result:

points 0.99733333330 points  0.99733333330

Test #82:

score: 74.93
Acceptable Answer
time: 4ms
memory: 4000kb

input:

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

output:

8
0 1675
8
2
8
0 223
8
2
8
0 978
8
2
8
0 1412
8
2
8
0 177
8
2
8
0 7
8
2
8
1 7
8
0 1346
8
2
8
0 1909
8
2
8
0 1803
8
2
8
0 1055
8
2
8
0 59
8
2
8
0 965
8
2
8
0 1985
8
2
8
0 1436
8
2
8
0 1177
8
2
8
0 488
8
2
8
0 197
8
2
8
0 1756
8
2
8
1 1756
8
0 1847
8
2
8
0 1855
8
2
8
0 915
8
2
8
0 411
8
2
8
0 1919
8
2...

result:

points 0.99906666670 points  0.99906666670

Test #83:

score: 74.93
Acceptable Answer
time: 4ms
memory: 3928kb

input:

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

output:

8
0 1675
8
2
8
0 223
8
2
8
0 978
8
2
8
0 1412
8
2
8
0 177
8
2
8
0 7
8
2
8
0 1346
8
2
8
0 1909
8
2
8
0 1803
8
2
8
0 1055
8
2
8
0 59
8
2
8
0 965
8
2
8
0 1985
8
2
8
0 1436
8
2
8
0 1177
8
2
8
0 488
8
2
8
0 197
8
2
8
0 1756
8
2
8
0 1847
8
2
8
1 1847
8
0 1855
8
2
8
0 915
8
2
8
0 411
8
2
8
1 411
8
0 1919
8...

result:

points 0.99906666670 points  0.99906666670

Test #84:

score: 50.02
Acceptable Answer
time: 2ms
memory: 3920kb

input:

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

output:

8
0 317
8
2
8
0 223
8
2
8
1 223
8
0 413
8
2
8
0 267
8
2
8
1 267
8
0 177
8
2
8
1 177
8
0 7
8
2
8
1 7
8
0 241
8
2
8
1 241
8
0 370
8
2
8
1 370
8
0 8
8
2
8
1 8
8
0 33
8
2
8
1 33
8
0 59
8
2
8
1 59
8
0 67
8
2
8
1 67
8
0 184
8
2
8
1 184
8
0 422
8
2
8
1 422
8
0 318
8
2
8
1 318
8
0 488
8
2
8
1 488
8
0 197
8
...

result:

points 0.66693333330 points  0.66693333330

Test #85:

score: 35.12
Acceptable Answer
time: 25ms
memory: 3928kb

input:

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

output:

8
0 1637
8
2
8
0 1065
8
2
8
0 346
8
2
8
1 346
8
0 1832
8
2
8
0 1719
8
2
8
1 1719
8
0 119
8
2
8
1 119
8
0 1440
8
2
8
1 1440
8
0 370
8
2
8
1 370
8
0 1488
8
2
8
1 1488
8
0 764
8
2
8
1 764
8
0 1683
8
2
8
1 1683
8
0 1091
8
2
8
1 1091
8
0 156
8
2
8
1 156
8
0 1313
8
2
8
1 1313
8
0 1635
8
2
8
1 1635
8
0 945...

result:

points 0.46826666670 points  0.46826666670

Test #86:

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

input:

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

output:

8
0 1637
8
2
8
0 1065
8
2
8
1 1065
8
0 346
8
2
8
0 1832
8
2
8
1 1832
8
0 1719
8
2
8
1 1719
8
0 119
8
2
8
1 119
8
0 1440
8
2
8
1 1440
8
0 370
8
2
8
1 370
8
0 1488
8
2
8
1 1488
8
0 764
8
2
8
1 764
8
0 1683
8
2
8
1 1683
8
0 1091
8
2
8
1 1091
8
0 156
8
2
8
1 156
8
0 1313
8
2
8
1 1313
8
0 1870
8
2
8
1 18...

result:

ok 

Test #87:

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

input:

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

output:

8
0 1786
8
2
8
0 268
8
2
8
0 274
8
2
8
1 274
8
0 835
8
2
8
1 835
8
0 351
8
2
8
1 351
8
0 620
8
2
8
1 620
8
0 134
8
2
8
1 134
8
0 925
8
2
8
1 925
8
0 1893
8
2
8
0 1245
8
2
8
0 2
8
2
8
1 2
8
0 1064
8
2
8
0 215
8
2
8
1 215
8
0 1009
8
2
8
0 674
8
2
8
1 674
8
0 1079
8
2
8
0 1048
8
2
8
0 266
8
2
8
1 266
8...

result:

ok 

Test #88:

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

input:

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

output:

8
0 1786
8
2
8
0 268
8
2
8
0 274
8
2
8
0 835
8
2
8
0 351
8
2
8
0 620
8
2
8
0 134
8
2
8
0 925
8
2
8
0 1893
8
2
8
1 1893
8
0 1245
8
2
8
1 1245
8
0 2
8
2
8
0 1064
8
2
8
1 1064
8
0 215
8
2
8
0 1009
8
2
8
1 1009
8
0 674
8
2
8
0 1079
8
2
8
1 1079
8
0 1048
8
2
8
1 1048
8
0 266
8
2
8
0 1050
8
2
8
1 1050
8
0...

result:

ok 

Test #89:

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

input:

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

output:

8
0 1786
8
2
8
0 268
8
2
8
1 268
8
0 274
8
2
8
1 274
8
0 835
8
2
8
0 351
8
2
8
1 351
8
0 620
8
2
8
0 134
8
2
8
1 134
8
0 925
8
2
8
0 1893
8
2
8
1 1893
8
0 1245
8
2
8
0 2
8
2
8
1 2
8
0 1064
8
2
8
0 215
8
2
8
1 215
8
0 1009
8
2
8
0 674
8
2
8
0 1079
8
2
8
0 1048
8
2
8
0 266
8
2
8
1 266
8
0 1050
8
2
8
0...

result:

ok