QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#430082#4565. Rarest Insectsjames1BadCreeper#50.03 27ms4224kbC++171.8kb2024-06-03 13:40:062024-06-03 13:40:07

Judging History

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

  • [2024-06-03 13:40:07]
  • 评测
  • 测评结果:50.03
  • 用时:27ms
  • 内存:4224kb
  • [2024-06-03 13:40:06]
  • 提交

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

input:

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

output:

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

result:

ok 

Test #2:

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

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

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

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

input:

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

output:

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

result:

ok 

Test #6:

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

input:

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

output:

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

result:

ok 

Test #7:

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

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 127
8
2
8
0 21
8
2
8
1 21
8
0 148
8
2
8
1 148
8
0 121
8
2
8
1 121
8
0 9
8
2
8
1 9
8
0 50
8
2
8
1 50
8
0 173
8
2
8
1 173
8
0 102
8
2
8
1 102
8
0 30
8
2
8
1 30
8
0 135
8
2
8
1 135
8
0 83
8
2
8
1 83
8
0 160
8
2
8
1 160
8
0 42
8
2
8
1 42
8
0 29
8
2
8
1 29
8
0 169
8
2
8
1 169
8
0 174
8
2
8
1 174
8
0 ...

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 126
8
2
8
0 20
8
2
8
0 171
8
2
8
0 120
8
2
8
0 1
8
2
8
0 107
8
2
8
0 172
8
2
8
0 25
8
2
8
0 9
8
2
8
0 173
8
2
8
0 161
8
2
8
0 70
8
2
8
0 28
8
2
8
0 109
8
2
8
0 168
8
2
8
0 131
8
2
8
0 144
8
2
8
0 83
8
2
8
0 42
8
2
8
0 158
8
2
8
0 106
8
2
8
0 140
8
2
8
0 169
8
2
8
0 187
8
2
8
0 156
8
2
8
0 182
8
...

result:

ok 

Test #9:

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

input:

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

output:

8
0 126
8
2
8
0 20
8
2
8
0 171
8
2
8
0 120
8
2
8
0 1
8
2
8
0 107
8
2
8
0 172
8
2
8
0 25
8
2
8
1 25
8
0 9
8
2
8
0 173
8
2
8
1 173
8
0 161
8
2
8
1 161
8
0 70
8
2
8
1 70
8
0 28
8
2
8
1 28
8
0 109
8
2
8
1 109
8
0 168
8
2
8
1 168
8
0 131
8
2
8
0 144
8
2
8
0 83
8
2
8
1 83
8
0 42
8
2
8
0 158
8
2
8
1 158
8
...

result:

ok 

Test #10:

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

input:

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

output:

8
0 126
8
2
8
0 20
8
2
8
0 171
8
2
8
0 120
8
2
8
0 1
8
2
8
0 107
8
2
8
0 172
8
2
8
1 172
8
0 25
8
2
8
1 25
8
0 9
8
2
8
0 173
8
2
8
1 173
8
0 161
8
2
8
0 70
8
2
8
1 70
8
0 28
8
2
8
1 28
8
0 109
8
2
8
1 109
8
0 168
8
2
8
1 168
8
0 131
8
2
8
1 131
8
0 144
8
2
8
1 144
8
0 83
8
2
8
1 83
8
0 42
8
2
8
0 15...

result:

ok 

Test #11:

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

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 127
8
2
8
0 21
8
2
8
1 21
8
0 148
8
2
8
1 148
8
0 121
8
2
8
1 121
8
0 9
8
2
8
1 9
8
0 50
8
2
8
1 50
8
0 173
8
2
8
1 173
8
0 102
8
2
8
1 102
8
0 30
8
2
8
1 30
8
0 135
8
2
8
1 135
8
0 83
8
2
8
1 83
8
0 160
8
2
8
1 160
8
0 42
8
2
8
1 42
8
0 29
8
2
8
1 29
8
0 169
8
2
8
1 169
8
0 174
8
2
8
1 174
8
0 ...

result:

ok 

Test #12:

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

input:

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

output:

8
0 127
8
2
8
0 21
8
2
8
0 148
8
2
8
0 121
8
2
8
0 9
8
2
8
0 50
8
2
8
1 50
8
0 173
8
2
8
0 102
8
2
8
1 102
8
0 30
8
2
8
0 135
8
2
8
1 135
8
0 83
8
2
8
1 83
8
0 160
8
2
8
0 42
8
2
8
1 42
8
0 29
8
2
8
1 29
8
0 169
8
2
8
1 169
8
0 174
8
2
8
0 145
8
2
8
1 145
8
0 24
8
2
8
0 176
8
2
8
1 176
8
0 154
8
2
8...

result:

ok 

Test #13:

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

input:

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

output:

8
0 127
8
2
8
0 21
8
2
8
0 148
8
2
8
0 121
8
2
8
1 121
8
0 9
8
2
8
1 9
8
0 50
8
2
8
0 173
8
2
8
1 173
8
0 102
8
2
8
1 102
8
0 30
8
2
8
1 30
8
0 135
8
2
8
1 135
8
0 83
8
2
8
1 83
8
0 160
8
2
8
1 160
8
0 42
8
2
8
1 42
8
0 29
8
2
8
1 29
8
0 169
8
2
8
1 169
8
0 174
8
2
8
1 174
8
0 145
8
2
8
1 145
8
0 24...

result:

ok 

Test #14:

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

input:

198
1
1
1
1
1
2
1
2
1
2
1
1
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
2
2
2
2
2
2
2
2
2
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 126
8
2
8
0 20
8
2
8
0 171
8
2
8
0 120
8
2
8
0 1
8
2
8
0 107
8
2
8
1 107
8
0 172
8
2
8
0 25
8
2
8
1 25
8
0 9
8
2
8
0 173
8
2
8
1 173
8
0 161
8
2
8
0 70
8
2
8
0 28
8
2
8
1 28
8
0 109
8
2
8
1 109
8
0 168
8
2
8
1 168
8
0 131
8
2
8
1 131
8
0 144
8
2
8
1 144
8
0 83
8
2
8
1 83
8
0 42
8
2
8
0 158
8
2
8...

result:

ok 

Test #15:

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

input:

200
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 126
8
2
8
0 20
8
2
8
0 171
8
2
8
0 120
8
2
8
0 1
8
2
8
1 1
8
0 107
8
2
8
1 107
8
0 172
8
2
8
1 172
8
0 25
8
2
8
1 25
8
0 9
8
2
8
1 9
8
0 173
8
2
8
1 173
8
0 161
8
2
8
1 161
8
0 70
8
2
8
1 70
8
0 28
8
2
8
1 28
8
0 109
8
2
8
1 109
8
0 168
8
2
8
1 168
8
0 131
8
2
8
1 131
8
0 144
8
2
8
1 144
8
0 83
...

result:

ok 

Test #16:

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

input:

196
1
2
1
1
2
2
2
1
1
2
2
1
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 126
8
2
8
0 20
8
2
8
1 20
8
0 171
8
2
8
0 120
8
2
8
0 1
8
2
8
1 1
8
0 107
8
2
8
1 107
8
0 172
8
2
8
1 172
8
0 25
8
2
8
0 9
8
2
8
0 173
8
2
8
1 173
8
0 161
8
2
8
1 161
8
0 70
8
2
8
0 28
8
2
8
1 28
8
0 109
8
2
8
1 109
8
0 168
8
2
8
1 168
8
0 131
8
2
8
1 131
8
0 144
8
2
8
0 83
8
2
8
1 83
8
0 42
8
2...

result:

ok 

Test #17:

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

input:

199
1
1
1
2
1
2
1
2
2
2
2
1
2
2
1
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 127
8
2
8
0 21
8
2
8
0 148
8
2
8
0 121
8
2
8
1 121
8
0 9
8
2
8
0 50
8
2
8
1 50
8
0 173
8
2
8
0 102
8
2
8
1 102
8
0 30
8
2
8
1 30
8
0 135
8
2
8
1 135
8
0 83
8
2
8
1 83
8
0 160
8
2
8
0 42
8
2
8
1 42
8
0 29
8
2
8
1 29
8
0 169
8
2
8
0 174
8
2
8
1 174
8
0 145
8
2
8
1 145
8
0 24
8
2
8
1 24
8
0 176
8
2...

result:

ok 

Test #18:

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

input:

196
1
2
1
1
1
1
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 126
8
2
8
0 20
8
2
8
1 20
8
0 171
8
2
8
0 120
8
2
8
0 1
8
2
8
0 107
8
2
8
0 172
8
2
8
0 25
8
2
8
0 9
8
2
8
0 173
8
2
8
0 161
8
2
8
0 70
8
2
8
1 70
8
0 28
8
2
8
1 28
8
0 109
8
2
8
0 168
8
2
8
1 168
8
0 131
8
2
8
1 131
8
0 144
8
2
8
1 144
8
0 83
8
2
8
1 83
8
0 42
8
2
8
1 42
8
0 158
8
2
8
1 158
8
0...

result:

ok 

Test #19:

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

input:

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

output:

8
0 126
8
2
8
0 20
8
2
8
0 171
8
2
8
0 120
8
2
8
0 1
8
2
8
0 107
8
2
8
1 107
8
0 172
8
2
8
0 25
8
2
8
1 25
8
0 9
8
2
8
1 9
8
0 173
8
2
8
0 161
8
2
8
1 161
8
0 70
8
2
8
0 28
8
2
8
0 109
8
2
8
1 109
8
0 168
8
2
8
1 168
8
0 131
8
2
8
0 144
8
2
8
0 83
8
2
8
1 83
8
0 42
8
2
8
1 42
8
0 158
8
2
8
1 158
8
0...

result:

ok 

Test #20:

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

input:

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

output:

8
0 126
8
2
8
0 20
8
2
8
0 171
8
2
8
0 120
8
2
8
0 1
8
2
8
0 107
8
2
8
1 107
8
0 172
8
2
8
0 25
8
2
8
0 9
8
2
8
1 9
8
0 173
8
2
8
0 161
8
2
8
0 70
8
2
8
0 28
8
2
8
0 109
8
2
8
0 168
8
2
8
1 168
8
0 131
8
2
8
1 131
8
0 144
8
2
8
0 83
8
2
8
1 83
8
0 42
8
2
8
1 42
8
0 158
8
2
8
1 158
8
0 106
8
2
8
0 14...

result:

ok 

Test #21:

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

input:

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

output:

8
0 126
8
2
8
0 20
8
2
8
0 171
8
2
8
0 120
8
2
8
0 1
8
2
8
0 107
8
2
8
0 172
8
2
8
0 25
8
2
8
0 9
8
2
8
0 173
8
2
8
0 161
8
2
8
0 70
8
2
8
1 70
8
0 28
8
2
8
0 109
8
2
8
0 168
8
2
8
0 131
8
2
8
0 144
8
2
8
0 83
8
2
8
0 42
8
2
8
0 158
8
2
8
1 158
8
0 106
8
2
8
1 106
8
0 140
8
2
8
0 169
8
2
8
0 187
8
2...

result:

ok 

Test #22:

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

input:

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

output:

8
0 127
8
2
8
0 21
8
2
8
0 148
8
2
8
0 121
8
2
8
0 9
8
2
8
0 50
8
2
8
0 173
8
2
8
0 102
8
2
8
0 30
8
2
8
0 135
8
2
8
0 83
8
2
8
0 160
8
2
8
0 42
8
2
8
0 29
8
2
8
0 169
8
2
8
0 174
8
2
8
1 174
8
0 145
8
2
8
0 24
8
2
8
0 176
8
2
8
0 154
8
2
8
0 159
8
2
8
0 49
8
2
8
0 141
8
2
8
0 60
8
2
8
0 157
8
2
8
0...

result:

ok 

Test #23:

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

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

output:

8
0 126
8
2
8
0 20
8
2
8
0 171
8
2
8
0 120
8
2
8
0 1
8
2
8
0 107
8
2
8
0 172
8
2
8
0 25
8
2
8
0 9
8
2
8
0 173
8
2
8
0 161
8
2
8
0 70
8
2
8
0 28
8
2
8
0 109
8
2
8
0 168
8
2
8
0 131
8
2
8
0 144
8
2
8
0 83
8
2
8
0 42
8
2
8
0 158
8
2
8
0 106
8
2
8
0 140
8
2
8
0 169
8
2
8
0 187
8
2
8
0 156
8
2
8
0 182
8
...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

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

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 844
8
2
8
0 825
8
2
8
1 825
8
0 383
8
2
8
1 383
8
0 414
8
2
8
1 414
8
0 861
8
2
8
1 861
8
0 560
8
2
8
1 560
8
0 247
8
2
8
1 247
8
0 25
8
2
8
1 25
8
0 325
8
2
8
1 325
8
0 968
8
2
8
1 968
8
0 495
8
2
8
1 495
8
0 630
8
2
8
1 630
8
0 790
8
2
8
1 790
8
0 109
8
2
8
1 109
8
0 168
8
2
8
1 168
8
0 694
8
...

result:

ok 

Test #25:

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

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 360
8
2
8
0 401
8
2
8
0 97
8
2
8
0 973
8
2
8
0 367
8
2
8
0 533
8
2
8
0 649
8
2
8
0 609
8
2
8
0 300
8
2
8
0 919
8
2
8
0 185
8
2
8
0 35
8
2
8
0 749
8
2
8
0 350
8
2
8
0 92
8
2
8
0 14
8
2
8
0 577
8
2
8
0 713
8
2
8
0 668
8
2
8
0 434
8
2
8
0 238
8
2
8
0 964
8
2
8
0 443
8
2
8
0 128
8
2
8
0 249
8
2
8
0 ...

result:

ok 

Test #26:

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

input:

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

output:

8
0 361
8
2
8
0 532
8
2
8
0 164
8
2
8
0 325
8
2
8
1 325
8
0 498
8
2
8
0 322
8
2
8
0 416
8
2
8
0 200
8
2
8
0 301
8
2
8
0 251
8
2
8
0 592
8
2
8
1 592
8
0 948
8
2
8
0 596
8
2
8
0 351
8
2
8
0 680
8
2
8
1 680
8
0 736
8
2
8
0 830
8
2
8
1 830
8
0 491
8
2
8
0 669
8
2
8
0 435
8
2
8
1 435
8
0 240
8
2
8
0 965
...

result:

ok 

Test #27:

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

input:

999
1
1
1
1
1
1
2
1
1
1
2
1
2
2
1
1
1
2
1
1
1
1
2
1
2
1
1
2
1
1
2
2
2
2
2
1
2
2
2
2
2
1
1
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
1
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 361
8
2
8
0 532
8
2
8
0 164
8
2
8
0 325
8
2
8
0 498
8
2
8
0 322
8
2
8
0 416
8
2
8
1 416
8
0 200
8
2
8
0 301
8
2
8
0 251
8
2
8
0 592
8
2
8
1 592
8
0 948
8
2
8
0 596
8
2
8
1 596
8
0 351
8
2
8
1 351
8
0 680
8
2
8
0 736
8
2
8
0 830
8
2
8
0 491
8
2
8
1 491
8
0 669
8
2
8
0 435
8
2
8
0 240
8
2
8
0 965
...

result:

ok 

Test #28:

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

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 360
8
2
8
0 401
8
2
8
1 401
8
0 97
8
2
8
1 97
8
0 973
8
2
8
1 973
8
0 367
8
2
8
1 367
8
0 533
8
2
8
1 533
8
0 649
8
2
8
1 649
8
0 609
8
2
8
1 609
8
0 300
8
2
8
1 300
8
0 919
8
2
8
1 919
8
0 185
8
2
8
1 185
8
0 35
8
2
8
1 35
8
0 749
8
2
8
1 749
8
0 350
8
2
8
1 350
8
0 92
8
2
8
1 92
8
0 14
8
2
8
1...

result:

ok 

Test #29:

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

input:

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

output:

8
0 361
8
2
8
0 532
8
2
8
0 164
8
2
8
1 164
8
0 325
8
2
8
1 325
8
0 498
8
2
8
1 498
8
0 322
8
2
8
0 416
8
2
8
0 200
8
2
8
0 301
8
2
8
1 301
8
0 251
8
2
8
0 592
8
2
8
0 948
8
2
8
1 948
8
0 596
8
2
8
1 596
8
0 351
8
2
8
0 680
8
2
8
0 736
8
2
8
0 830
8
2
8
0 491
8
2
8
1 491
8
0 669
8
2
8
1 669
8
0 435
...

result:

ok 

Test #30:

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

input:

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

output:

8
0 360
8
2
8
0 401
8
2
8
0 97
8
2
8
0 973
8
2
8
1 973
8
0 367
8
2
8
1 367
8
0 533
8
2
8
0 649
8
2
8
1 649
8
0 609
8
2
8
1 609
8
0 300
8
2
8
1 300
8
0 919
8
2
8
1 919
8
0 185
8
2
8
1 185
8
0 35
8
2
8
1 35
8
0 749
8
2
8
1 749
8
0 350
8
2
8
1 350
8
0 92
8
2
8
1 92
8
0 14
8
2
8
1 14
8
0 577
8
2
8
1 577...

result:

ok 

Test #31:

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

input:

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

output:

8
0 265
8
2
8
0 938
8
2
8
0 237
8
2
8
0 288
8
2
8
0 979
8
2
8
0 526
8
2
8
1 526
8
0 480
8
2
8
0 689
8
2
8
0 208
8
2
8
0 184
8
2
8
1 184
8
0 396
8
2
8
0 353
8
2
8
1 353
8
0 597
8
2
8
1 597
8
0 884
8
2
8
1 884
8
0 474
8
2
8
0 206
8
2
8
0 509
8
2
8
0 257
8
2
8
0 542
8
2
8
0 408
8
2
8
1 408
8
0 545
8
2
...

result:

ok 

Test #32:

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

input:

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

output:

8
0 265
8
2
8
0 938
8
2
8
1 938
8
0 237
8
2
8
0 288
8
2
8
1 288
8
0 979
8
2
8
0 526
8
2
8
0 480
8
2
8
1 480
8
0 689
8
2
8
0 208
8
2
8
1 208
8
0 184
8
2
8
1 184
8
0 396
8
2
8
1 396
8
0 353
8
2
8
1 353
8
0 597
8
2
8
1 597
8
0 884
8
2
8
1 884
8
0 474
8
2
8
1 474
8
0 206
8
2
8
1 206
8
0 509
8
2
8
1 509
...

result:

ok 

Test #33:

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

input:

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

output:

8
0 265
8
2
8
0 938
8
2
8
0 237
8
2
8
1 237
8
0 288
8
2
8
0 979
8
2
8
1 979
8
0 526
8
2
8
0 480
8
2
8
0 689
8
2
8
0 208
8
2
8
1 208
8
0 184
8
2
8
1 184
8
0 396
8
2
8
1 396
8
0 353
8
2
8
1 353
8
0 597
8
2
8
1 597
8
0 884
8
2
8
1 884
8
0 474
8
2
8
0 206
8
2
8
1 206
8
0 509
8
2
8
1 509
8
0 257
8
2
8
1 ...

result:

ok 

Test #34:

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

input:

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

output:

8
0 265
8
2
8
0 938
8
2
8
0 237
8
2
8
0 288
8
2
8
0 979
8
2
8
1 979
8
0 526
8
2
8
0 480
8
2
8
1 480
8
0 689
8
2
8
0 208
8
2
8
1 208
8
0 184
8
2
8
1 184
8
0 396
8
2
8
0 353
8
2
8
0 597
8
2
8
1 597
8
0 884
8
2
8
0 474
8
2
8
1 474
8
0 206
8
2
8
1 206
8
0 509
8
2
8
1 509
8
0 257
8
2
8
1 257
8
0 542
8
2
...

result:

ok 

Test #35:

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

input:

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

output:

8
0 295
8
2
8
0 822
8
2
8
0 199
8
2
8
0 747
8
2
8
0 459
8
2
8
1 459
8
0 990
8
2
8
0 343
8
2
8
0 37
8
2
8
1 37
8
0 364
8
2
8
0 573
8
2
8
0 746
8
2
8
1 746
8
0 36
8
2
8
1 36
8
0 677
8
2
8
1 677
8
0 798
8
2
8
0 732
8
2
8
1 732
8
0 418
8
2
8
1 418
8
0 285
8
2
8
1 285
8
0 149
8
2
8
1 149
8
0 681
8
2
8
0 ...

result:

ok 

Test #36:

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

input:

997
1
1
1
1
1
1
1
1
2
2
2
1
1
2
2
2
1
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 404
8
2
8
0 823
8
2
8
0 135
8
2
8
0 215
8
2
8
0 22
8
2
8
0 991
8
2
8
0 308
8
2
8
0 890
8
2
8
0 365
8
2
8
1 365
8
0 84
8
2
8
1 84
8
0 747
8
2
8
1 747
8
0 456
8
2
8
0 524
8
2
8
0 812
8
2
8
1 812
8
0 733
8
2
8
1 733
8
0 419
8
2
8
1 419
8
0 466
8
2
8
0 110
8
2
8
1 110
8
0 366
8
2
8
1 366
8
0 330
8
2...

result:

ok 

Test #37:

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

input:

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

output:

8
0 404
8
2
8
0 823
8
2
8
0 135
8
2
8
0 215
8
2
8
1 215
8
0 22
8
2
8
0 991
8
2
8
0 308
8
2
8
0 890
8
2
8
1 890
8
0 365
8
2
8
0 84
8
2
8
0 747
8
2
8
0 456
8
2
8
0 524
8
2
8
1 524
8
0 812
8
2
8
0 733
8
2
8
1 733
8
0 419
8
2
8
0 466
8
2
8
0 110
8
2
8
0 366
8
2
8
0 330
8
2
8
1 330
8
0 928
8
2
8
1 928
8
...

result:

ok 

Test #38:

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

input:

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

output:

8
0 404
8
2
8
0 823
8
2
8
0 135
8
2
8
0 215
8
2
8
0 22
8
2
8
0 991
8
2
8
0 308
8
2
8
0 890
8
2
8
0 365
8
2
8
1 365
8
0 84
8
2
8
0 747
8
2
8
0 456
8
2
8
0 524
8
2
8
1 524
8
0 812
8
2
8
0 733
8
2
8
0 419
8
2
8
0 466
8
2
8
0 110
8
2
8
1 110
8
0 366
8
2
8
0 330
8
2
8
1 330
8
0 928
8
2
8
0 771
8
2
8
0 35...

result:

ok 

Test #39:

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

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

output:

8
0 404
8
2
8
0 823
8
2
8
0 135
8
2
8
0 215
8
2
8
0 22
8
2
8
0 991
8
2
8
0 308
8
2
8
0 890
8
2
8
0 365
8
2
8
0 84
8
2
8
0 747
8
2
8
0 456
8
2
8
0 524
8
2
8
0 812
8
2
8
0 733
8
2
8
0 419
8
2
8
0 466
8
2
8
0 110
8
2
8
1 110
8
0 366
8
2
8
0 330
8
2
8
0 928
8
2
8
0 771
8
2
8
0 352
8
2
8
0 682
8
2
8
1 68...

result:

ok 

Test #40:

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

input:

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

output:

8
0 181
8
2
8
0 420
8
2
8
0 693
8
2
8
0 884
8
2
8
0 859
8
2
8
0 365
8
2
8
0 255
8
2
8
0 523
8
2
8
0 134
8
2
8
0 72
8
2
8
0 141
8
2
8
0 306
8
2
8
0 294
8
2
8
0 629
8
2
8
0 707
8
2
8
0 349
8
2
8
0 293
8
2
8
0 490
8
2
8
0 69
8
2
8
1 69
8
0 584
8
2
8
0 906
8
2
8
0 46
8
2
8
0 486
8
2
8
0 8
8
2
8
0 303
8
...

result:

ok 

Test #41:

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

input:

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

output:

8
0 38
8
2
8
0 772
8
2
8
0 802
8
2
8
0 885
8
2
8
0 749
8
2
8
0 308
8
2
8
0 203
8
2
8
0 443
8
2
8
0 466
8
2
8
0 434
8
2
8
0 838
8
2
8
0 916
8
2
8
0 810
8
2
8
0 392
8
2
8
0 175
8
2
8
0 724
8
2
8
0 86
8
2
8
0 978
8
2
8
1 978
8
0 22
8
2
8
0 776
8
2
8
0 907
8
2
8
0 792
8
2
8
0 487
8
2
8
0 0
8
2
8
0 133
8...

result:

ok 

Test #42:

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

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

output:

8
0 38
8
2
8
0 772
8
2
8
0 802
8
2
8
0 885
8
2
8
0 749
8
2
8
0 308
8
2
8
0 203
8
2
8
0 443
8
2
8
0 466
8
2
8
0 434
8
2
8
0 838
8
2
8
0 916
8
2
8
0 810
8
2
8
0 392
8
2
8
0 175
8
2
8
0 724
8
2
8
0 86
8
2
8
0 978
8
2
8
0 22
8
2
8
0 776
8
2
8
0 907
8
2
8
0 792
8
2
8
0 487
8
2
8
0 0
8
2
8
0 133
8
2
8
0 1...

result:

ok 

Subtask #3:

score: 25.03
Acceptable Answer

Test #43:

score: 75
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 #44:

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

input:

2
1
1

output:

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

result:

ok 

Test #45:

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

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 #46:

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

input:

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

output:

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

result:

ok 

Test #47:

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

input:

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

output:

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

result:

ok 

Test #48:

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

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 181
8
2
8
0 420
8
2
8
1 420
8
0 693
8
2
8
1 693
8
0 884
8
2
8
1 884
8
0 859
8
2
8
1 859
8
0 1658
8
2
8
1 1658
8
0 1130
8
2
8
1 1130
8
0 1179
8
2
8
1 1179
8
0 1997
8
2
8
1 1997
8
0 1926
8
2
8
1 1926
8
0 141
8
2
8
1 141
8
0 306
8
2
8
1 306
8
0 294
8
2
8
1 294
8
0 629
8
2
8
1 629
8
0 1207
8
2
8
1 1...

result:

ok 

Test #49:

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

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 181
8
2
8
0 420
8
2
8
0 693
8
2
8
0 884
8
2
8
0 859
8
2
8
0 1658
8
2
8
0 1130
8
2
8
0 1179
8
2
8
0 1997
8
2
8
0 1926
8
2
8
0 141
8
2
8
0 306
8
2
8
0 294
8
2
8
0 629
8
2
8
0 1207
8
2
8
0 1241
8
2
8
0 1812
8
2
8
0 1860
8
2
8
0 1309
8
2
8
0 584
8
2
8
0 1024
8
2
8
0 46
8
2
8
0 486
8
2
8
0 8
8
2
8
0 ...

result:

ok 

Test #50:

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

input:

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

output:

8
0 181
8
2
8
0 420
8
2
8
0 693
8
2
8
1 693
8
0 884
8
2
8
0 859
8
2
8
0 1658
8
2
8
0 1130
8
2
8
0 1179
8
2
8
0 1997
8
2
8
0 1926
8
2
8
0 141
8
2
8
0 306
8
2
8
0 294
8
2
8
1 294
8
0 629
8
2
8
0 1207
8
2
8
0 1241
8
2
8
0 1812
8
2
8
0 1860
8
2
8
0 1309
8
2
8
1 1309
8
0 584
8
2
8
0 1024
8
2
8
1 1024
8
0...

result:

ok 

Test #51:

score: 70.58
Acceptable Answer
time: 20ms
memory: 4000kb

input:

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

output:

8
0 1889
8
2
8
0 249
8
2
8
0 1433
8
2
8
0 1594
8
2
8
0 261
8
2
8
0 902
8
2
8
0 942
8
2
8
0 708
8
2
8
0 1820
8
2
8
0 1558
8
2
8
0 498
8
2
8
0 502
8
2
8
0 1589
8
2
8
0 412
8
2
8
0 895
8
2
8
0 1714
8
2
8
1 1714
8
0 1418
8
2
8
0 534
8
2
8
0 1324
8
2
8
0 1431
8
2
8
1 1431
8
0 1379
8
2
8
1 1379
8
0 1710
8...

result:

points 0.94106666670 points  0.94106666670

Test #52:

score: 25.03
Acceptable Answer
time: 18ms
memory: 3932kb

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 1889
8
2
8
0 249
8
2
8
1 249
8
0 1433
8
2
8
1 1433
8
0 1594
8
2
8
1 1594
8
0 261
8
2
8
1 261
8
0 902
8
2
8
1 902
8
0 942
8
2
8
1 942
8
0 708
8
2
8
1 708
8
0 1820
8
2
8
1 1820
8
0 1558
8
2
8
1 1558
8
0 498
8
2
8
1 498
8
0 502
8
2
8
1 502
8
0 1589
8
2
8
1 1589
8
0 412
8
2
8
1 412
8
0 895
8
2
8
1 8...

result:

points 0.33373333330 points  0.33373333330

Test #53:

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

input:

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

output:

8
0 510
8
2
8
0 887
8
2
8
0 1175
8
2
8
0 34
8
2
8
1 34
8
0 1717
8
2
8
1 1717
8
0 113
8
2
8
1 113
8
0 559
8
2
8
1 559
8
0 733
8
2
8
0 1894
8
2
8
1 1894
8
0 1984
8
2
8
0 1532
8
2
8
0 930
8
2
8
1 930
8
0 1765
8
2
8
1 1765
8
0 1042
8
2
8
0 1714
8
2
8
1 1714
8
0 1429
8
2
8
1 1429
8
0 1618
8
2
8
1 1618
8
...

result:

ok 

Test #54:

score: 28.2
Acceptable Answer
time: 11ms
memory: 3924kb

input:

2000
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 510
8
2
8
0 887
8
2
8
1 887
8
0 1175
8
2
8
0 34
8
2
8
0 1717
8
2
8
1 1717
8
0 113
8
2
8
0 559
8
2
8
1 559
8
0 733
8
2
8
1 733
8
0 1894
8
2
8
1 1894
8
0 1984
8
2
8
1 1984
8
0 1532
8
2
8
1 1532
8
0 930
8
2
8
1 930
8
0 1765
8
2
8
1 1765
8
0 1042
8
2
8
1 1042
8
0 1714
8
2
8
1 1714
8
0 1429
8
2
8
1 1...

result:

points 0.3760 points  0.3760

Test #55:

score: 57.87
Acceptable Answer
time: 17ms
memory: 3924kb

input:

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

output:

8
0 1671
8
2
8
0 90
8
2
8
0 655
8
2
8
0 1216
8
2
8
0 1471
8
2
8
0 1891
8
2
8
0 1496
8
2
8
0 937
8
2
8
0 1768
8
2
8
1 1768
8
0 1324
8
2
8
0 701
8
2
8
0 627
8
2
8
1 627
8
0 183
8
2
8
0 207
8
2
8
0 755
8
2
8
0 1499
8
2
8
0 1427
8
2
8
0 1527
8
2
8
0 1225
8
2
8
0 1213
8
2
8
1 1213
8
0 1750
8
2
8
0 192
8
...

result:

points 0.77160 points  0.77160

Test #56:

score: 74.56
Acceptable Answer
time: 0ms
memory: 3924kb

input:

1998
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1455
8
2
8
0 504
8
2
8
0 132
8
2
8
1 132
8
0 967
8
2
8
0 1676
8
2
8
0 1867
8
2
8
1 1867
8
0 1560
8
2
8
0 542
8
2
8
1 542
8
0 489
8
2
8
1 489
8
0 1939
8
2
8
1 1939
8
0 912
8
2
8
1 912
8
0 205
8
2
8
1 205
8
0 1885
8
2
8
1 1885
8
0 1427
8
2
8
1 1427
8
0 342
8
2
8
1 342
8
0 1553
8
2
8
1 1553
8
0 154...

result:

points 0.99413333330 points  0.99413333330

Test #57:

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

input:

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

output:

8
0 143
8
2
8
0 505
8
2
8
0 1220
8
2
8
0 910
8
2
8
0 1677
8
2
8
0 908
8
2
8
0 1561
8
2
8
1 1561
8
0 543
8
2
8
1 543
8
0 1726
8
2
8
1 1726
8
0 415
8
2
8
0 936
8
2
8
1 936
8
0 1354
8
2
8
1 1354
8
0 1323
8
2
8
0 802
8
2
8
1 802
8
0 806
8
2
8
1 806
8
0 65
8
2
8
1 65
8
0 1543
8
2
8
1 1543
8
0 658
8
2
8
1...

result:

points 0.99346666670 points  0.99346666670

Test #58:

score: 73.62
Acceptable Answer
time: 8ms
memory: 3940kb

input:

1997
1
1
2
1
2
1
2
2
2
2
1
2
1
1
2
2
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
2
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 143
8
2
8
0 505
8
2
8
0 1220
8
2
8
1 1220
8
0 910
8
2
8
0 1677
8
2
8
1 1677
8
0 908
8
2
8
0 1561
8
2
8
1 1561
8
0 543
8
2
8
1 543
8
0 1726
8
2
8
1 1726
8
0 415
8
2
8
1 415
8
0 936
8
2
8
0 1354
8
2
8
1 1354
8
0 1323
8
2
8
0 802
8
2
8
0 806
8
2
8
1 806
8
0 65
8
2
8
1 65
8
0 1543
8
2
8
0 658
8
2
8
...

result:

points 0.98160 points  0.98160

Test #59:

score: 72.83
Acceptable Answer
time: 11ms
memory: 4212kb

input:

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

output:

8
0 1455
8
2
8
0 504
8
2
8
0 132
8
2
8
0 967
8
2
8
1 967
8
0 1676
8
2
8
1 1676
8
0 1867
8
2
8
0 1560
8
2
8
0 542
8
2
8
1 542
8
0 489
8
2
8
0 1939
8
2
8
0 912
8
2
8
0 205
8
2
8
1 205
8
0 1885
8
2
8
1 1885
8
0 1427
8
2
8
1 1427
8
0 342
8
2
8
0 1553
8
2
8
1 1553
8
0 1542
8
2
8
0 1613
8
2
8
1 1613
8
0 1...

result:

points 0.97106666670 points  0.97106666670

Test #60:

score: 72.3
Acceptable Answer
time: 27ms
memory: 3888kb

input:

1996
1
1
1
1
1
1
2
2
2
2
1
1
1
2
1
1
2
2
2
2
2
2
2
1
1
2
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1831
8
2
8
0 1552
8
2
8
0 1780
8
2
8
0 1918
8
2
8
0 51
8
2
8
0 1338
8
2
8
0 481
8
2
8
1 481
8
0 418
8
2
8
1 418
8
0 1326
8
2
8
1 1326
8
0 892
8
2
8
1 892
8
0 1638
8
2
8
0 1424
8
2
8
0 296
8
2
8
0 1499
8
2
8
1 1499
8
0 1731
8
2
8
0 832
8
2
8
0 1387
8
2
8
1 1387
8
0 1807
8
2
8
1 1807
8
0 986
8
2
8...

result:

points 0.9640 points  0.9640

Test #61:

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

input:

2000
1
1
2
1
1
1
1
1
1
2
2
2
2
2
2
1
2
2
2
1
1
1
2
1
2
2
1
2
2
2
1
2
2
2
2
2
1
2
1
2
2
2
2
2
1
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1831
8
2
8
0 1552
8
2
8
0 1780
8
2
8
1 1780
8
0 1918
8
2
8
0 51
8
2
8
0 1338
8
2
8
0 481
8
2
8
0 418
8
2
8
0 1326
8
2
8
0 892
8
2
8
1 892
8
0 1638
8
2
8
1 1638
8
0 1424
8
2
8
1 1424
8
0 296
8
2
8
1 296
8
0 1499
8
2
8
1 1499
8
0 1731
8
2
8
1 1731
8
0 832
8
2
8
0 1387
8
2
8
1 1387
8
0 1807
8
2
8
1...

result:

points 0.97106666670 points  0.97106666670

Test #62:

score: 70.74
Acceptable Answer
time: 16ms
memory: 3916kb

input:

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

output:

8
0 1831
8
2
8
0 1552
8
2
8
0 1780
8
2
8
1 1780
8
0 1918
8
2
8
0 51
8
2
8
0 1338
8
2
8
1 1338
8
0 481
8
2
8
0 418
8
2
8
0 1326
8
2
8
0 892
8
2
8
0 1638
8
2
8
0 1424
8
2
8
0 296
8
2
8
0 1499
8
2
8
0 1731
8
2
8
0 832
8
2
8
0 1387
8
2
8
0 1807
8
2
8
1 1807
8
0 986
8
2
8
0 1258
8
2
8
1 1258
8
0 1830
8
2...

result:

points 0.94320 points  0.94320

Test #63:

score: 73.07
Acceptable Answer
time: 0ms
memory: 3956kb

input:

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

output:

8
0 770
8
2
8
0 595
8
2
8
0 1963
8
2
8
0 1778
8
2
8
0 131
8
2
8
0 1944
8
2
8
0 1600
8
2
8
0 1422
8
2
8
0 1613
8
2
8
1 1613
8
0 1092
8
2
8
0 1142
8
2
8
0 567
8
2
8
0 612
8
2
8
0 997
8
2
8
1 997
8
0 280
8
2
8
0 1414
8
2
8
0 258
8
2
8
0 1568
8
2
8
0 354
8
2
8
0 292
8
2
8
0 641
8
2
8
0 1776
8
2
8
1 1776...

result:

points 0.97426666670 points  0.97426666670

Test #64:

score: 71.88
Acceptable Answer
time: 8ms
memory: 4224kb

input:

1995
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
1
1
1
1
1
1
1
1
1
2
1
2
1
1
1
1
2
1
1
2
2
1
1
1
1
1
1
1
1
2
1
2
1
1
1
1
2
1
1
1
2
1
1
2
1
2
1
1
1
1
1
2
1
1
2
2
2
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
2
2
2
1
2
2
1
2
2
1
1
1
2
2
2
1
1
1
2
2
1
2
1
2
2
2
2
2
2
2
1
2
1
1
1
1
1
1
1
2
1
1
2
1
1
1
1
2...

output:

8
0 771
8
2
8
0 305
8
2
8
0 515
8
2
8
0 1779
8
2
8
0 1528
8
2
8
0 1945
8
2
8
0 1601
8
2
8
0 1423
8
2
8
0 1417
8
2
8
0 1788
8
2
8
0 1454
8
2
8
0 822
8
2
8
0 613
8
2
8
0 932
8
2
8
0 724
8
2
8
0 1415
8
2
8
0 259
8
2
8
0 1569
8
2
8
0 1774
8
2
8
0 293
8
2
8
0 334
8
2
8
0 1777
8
2
8
0 1624
8
2
8
1 1624
8
...

result:

points 0.95840 points  0.95840

Test #65:

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

input:

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

output:

8
0 771
8
2
8
0 305
8
2
8
0 515
8
2
8
0 1779
8
2
8
0 1528
8
2
8
0 1945
8
2
8
0 1601
8
2
8
0 1423
8
2
8
0 1417
8
2
8
0 1788
8
2
8
0 1454
8
2
8
0 822
8
2
8
0 613
8
2
8
0 932
8
2
8
0 724
8
2
8
0 1415
8
2
8
1 1415
8
0 259
8
2
8
0 1569
8
2
8
0 1774
8
2
8
0 293
8
2
8
0 334
8
2
8
0 1777
8
2
8
0 1624
8
2
8
...

result:

ok 

Test #66:

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

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

output:

8
0 1022
8
2
8
0 220
8
2
8
0 435
8
2
8
0 286
8
2
8
0 168
8
2
8
0 1021
8
2
8
0 1373
8
2
8
0 905
8
2
8
0 1296
8
2
8
0 1379
8
2
8
0 147
8
2
8
0 545
8
2
8
0 359
8
2
8
0 930
8
2
8
0 270
8
2
8
0 1300
8
2
8
0 75
8
2
8
0 544
8
2
8
0 909
8
2
8
0 555
8
2
8
0 1597
8
2
8
0 1484
8
2
8
0 741
8
2
8
0 638
8
2
8
1 6...

result:

ok 

Test #67:

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

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
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
2
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 1023
8
2
8
0 1146
8
2
8
0 387
8
2
8
0 287
8
2
8
0 169
8
2
8
0 1462
8
2
8
0 449
8
2
8
0 4
8
2
8
0 1297
8
2
8
0 47
8
2
8
0 298
8
2
8
0 357
8
2
8
0 1730
8
2
8
0 1848
8
2
8
0 271
8
2
8
0 1301
8
2
8
0 33
8
2
8
0 780
8
2
8
0 1630
8
2
8
0 1536
8
2
8
0 368
8
2
8
0 1485
8
2
8
0 61
8
2
8
0 639
8
2
8
0 140...

result:

ok 

Test #68:

score: 74.76
Acceptable Answer
time: 22ms
memory: 3952kb

input:

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

output:

8
0 1023
8
2
8
0 1146
8
2
8
0 387
8
2
8
0 287
8
2
8
0 169
8
2
8
1 169
8
0 1462
8
2
8
0 449
8
2
8
0 4
8
2
8
0 1297
8
2
8
0 47
8
2
8
0 298
8
2
8
0 357
8
2
8
1 357
8
0 1730
8
2
8
0 1848
8
2
8
1 1848
8
0 271
8
2
8
0 1301
8
2
8
1 1301
8
0 33
8
2
8
1 33
8
0 780
8
2
8
0 1630
8
2
8
0 1536
8
2
8
0 368
8
2
8
...

result:

points 0.99680 points  0.99680

Test #69:

score: 74.76
Acceptable Answer
time: 6ms
memory: 4000kb

input:

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

output:

8
0 1023
8
2
8
0 1146
8
2
8
0 387
8
2
8
0 287
8
2
8
0 169
8
2
8
1 169
8
0 1462
8
2
8
0 449
8
2
8
0 4
8
2
8
0 1297
8
2
8
0 47
8
2
8
0 298
8
2
8
0 357
8
2
8
1 357
8
0 1730
8
2
8
0 1848
8
2
8
1 1848
8
0 271
8
2
8
0 1301
8
2
8
1 1301
8
0 33
8
2
8
1 33
8
0 780
8
2
8
0 1630
8
2
8
0 1536
8
2
8
0 368
8
2
8
...

result:

points 0.99680 points  0.99680

Test #70:

score: 74.89
Acceptable Answer
time: 16ms
memory: 4212kb

input:

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

output:

8
0 1023
8
2
8
0 1146
8
2
8
0 387
8
2
8
0 287
8
2
8
0 169
8
2
8
0 1462
8
2
8
0 449
8
2
8
0 4
8
2
8
0 1297
8
2
8
0 47
8
2
8
0 298
8
2
8
1 298
8
0 357
8
2
8
0 1730
8
2
8
0 1848
8
2
8
1 1848
8
0 271
8
2
8
1 271
8
0 1301
8
2
8
0 33
8
2
8
0 780
8
2
8
1 780
8
0 1630
8
2
8
0 1536
8
2
8
0 368
8
2
8
0 1485
8...

result:

points 0.99853333330 points  0.99853333330

Test #71:

score: 74.89
Acceptable Answer
time: 8ms
memory: 3928kb

input:

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

output:

8
0 1289
8
2
8
0 1524
8
2
8
0 1444
8
2
8
0 396
8
2
8
0 1935
8
2
8
0 1860
8
2
8
0 407
8
2
8
0 1219
8
2
8
1 1219
8
0 1176
8
2
8
1 1176
8
0 1192
8
2
8
0 210
8
2
8
0 1375
8
2
8
0 1678
8
2
8
0 226
8
2
8
1 226
8
0 1205
8
2
8
1 1205
8
0 685
8
2
8
0 1023
8
2
8
0 254
8
2
8
0 1479
8
2
8
0 155
8
2
8
0 203
8
2
...

result:

points 0.99853333330 points  0.99853333330

Test #72:

score: 70.81
Acceptable Answer
time: 9ms
memory: 3936kb

input:

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

output:

8
0 1289
8
2
8
0 1524
8
2
8
0 1444
8
2
8
0 396
8
2
8
0 1935
8
2
8
0 1860
8
2
8
0 407
8
2
8
0 1219
8
2
8
0 1176
8
2
8
0 1192
8
2
8
0 210
8
2
8
0 1375
8
2
8
0 1678
8
2
8
0 226
8
2
8
1 226
8
0 1205
8
2
8
0 685
8
2
8
0 1023
8
2
8
0 254
8
2
8
1 254
8
0 1479
8
2
8
0 155
8
2
8
0 203
8
2
8
1 203
8
0 901
8
2...

result:

points 0.94413333330 points  0.94413333330

Test #73:

score: 70.81
Acceptable Answer
time: 8ms
memory: 3868kb

input:

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

output:

8
0 1289
8
2
8
0 1524
8
2
8
0 1444
8
2
8
0 396
8
2
8
0 1935
8
2
8
0 1860
8
2
8
0 407
8
2
8
0 1219
8
2
8
0 1176
8
2
8
0 1192
8
2
8
0 210
8
2
8
1 210
8
0 1375
8
2
8
1 1375
8
0 1678
8
2
8
1 1678
8
0 226
8
2
8
0 1205
8
2
8
1 1205
8
0 685
8
2
8
0 1023
8
2
8
0 254
8
2
8
0 1479
8
2
8
0 155
8
2
8
0 203
8
2
...

result:

points 0.94413333330 points  0.94413333330

Test #74:

score: 66.24
Acceptable Answer
time: 6ms
memory: 4220kb

input:

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

output:

8
0 733
8
2
8
0 975
8
2
8
0 308
8
2
8
0 559
8
2
8
0 1517
8
2
8
0 1376
8
2
8
0 371
8
2
8
0 1644
8
2
8
0 1021
8
2
8
0 811
8
2
8
0 1333
8
2
8
0 1523
8
2
8
0 1033
8
2
8
0 167
8
2
8
0 1326
8
2
8
0 255
8
2
8
1 255
8
0 156
8
2
8
0 352
8
2
8
0 516
8
2
8
0 343
8
2
8
0 1372
8
2
8
0 318
8
2
8
0 24
8
2
8
0 1207...

result:

points 0.88320 points  0.88320

Test #75:

score: 66.24
Acceptable Answer
time: 12ms
memory: 3936kb

input:

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

output:

8
0 733
8
2
8
0 975
8
2
8
0 308
8
2
8
0 559
8
2
8
0 1517
8
2
8
0 1376
8
2
8
0 371
8
2
8
0 1644
8
2
8
0 1021
8
2
8
0 811
8
2
8
0 1333
8
2
8
0 1523
8
2
8
0 1033
8
2
8
0 167
8
2
8
0 1326
8
2
8
0 255
8
2
8
1 255
8
0 156
8
2
8
0 352
8
2
8
0 516
8
2
8
0 343
8
2
8
0 1372
8
2
8
0 318
8
2
8
0 24
8
2
8
0 1207...

result:

points 0.88320 points  0.88320

Test #76:

score: 74.9
Acceptable Answer
time: 0ms
memory: 3972kb

input:

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

output:

8
0 1149
8
2
8
0 974
8
2
8
0 1505
8
2
8
0 558
8
2
8
0 1516
8
2
8
0 370
8
2
8
0 160
8
2
8
0 543
8
2
8
0 1579
8
2
8
0 810
8
2
8
0 1332
8
2
8
0 1522
8
2
8
1 1522
8
0 1615
8
2
8
0 166
8
2
8
0 1507
8
2
8
0 279
8
2
8
0 893
8
2
8
0 1055
8
2
8
0 1501
8
2
8
1 1501
8
0 533
8
2
8
0 1783
8
2
8
0 109
8
2
8
1 109...

result:

points 0.99866666670 points  0.99866666670

Test #77:

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

input:

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

output:

8
0 618
8
2
8
0 1294
8
2
8
0 1174
8
2
8
0 196
8
2
8
1 196
8
0 685
8
2
8
0 1642
8
2
8
0 1788
8
2
8
0 730
8
2
8
0 1326
8
2
8
1 1326
8
0 1270
8
2
8
0 216
8
2
8
0 1355
8
2
8
0 560
8
2
8
0 179
8
2
8
0 812
8
2
8
0 517
8
2
8
0 1024
8
2
8
0 1443
8
2
8
0 1462
8
2
8
0 745
8
2
8
0 79
8
2
8
1 79
8
0 573
8
2
8
0...

result:

points 0.99866666670 points  0.99866666670

Test #78:

score: 70.81
Acceptable Answer
time: 7ms
memory: 3920kb

input:

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

output:

8
0 618
8
2
8
0 1294
8
2
8
0 1174
8
2
8
0 196
8
2
8
0 685
8
2
8
0 1642
8
2
8
0 1788
8
2
8
0 730
8
2
8
0 1326
8
2
8
1 1326
8
0 1270
8
2
8
0 216
8
2
8
0 1355
8
2
8
0 560
8
2
8
0 179
8
2
8
0 812
8
2
8
0 517
8
2
8
1 517
8
0 1024
8
2
8
0 1443
8
2
8
0 1462
8
2
8
0 745
8
2
8
0 79
8
2
8
0 573
8
2
8
0 1862
8...

result:

points 0.94413333330 points  0.94413333330

Test #79:

score: 70.81
Acceptable Answer
time: 22ms
memory: 3980kb

input:

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

output:

8
0 618
8
2
8
0 1294
8
2
8
0 1174
8
2
8
0 196
8
2
8
0 685
8
2
8
0 1642
8
2
8
0 1788
8
2
8
0 730
8
2
8
0 1326
8
2
8
1 1326
8
0 1270
8
2
8
0 216
8
2
8
0 1355
8
2
8
0 560
8
2
8
0 179
8
2
8
0 812
8
2
8
0 517
8
2
8
1 517
8
0 1024
8
2
8
0 1443
8
2
8
0 1462
8
2
8
0 745
8
2
8
0 79
8
2
8
0 573
8
2
8
0 1862
8...

result:

points 0.94413333330 points  0.94413333330

Test #80:

score: 74.8
Acceptable Answer
time: 24ms
memory: 3876kb

input:

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

output:

8
0 1425
8
2
8
0 940
8
2
8
0 1308
8
2
8
1 1308
8
0 1846
8
2
8
0 971
8
2
8
0 856
8
2
8
0 706
8
2
8
1 706
8
0 250
8
2
8
0 217
8
2
8
0 1986
8
2
8
0 778
8
2
8
0 481
8
2
8
0 1040
8
2
8
0 1003
8
2
8
0 1278
8
2
8
0 1509
8
2
8
0 950
8
2
8
0 1010
8
2
8
0 58
8
2
8
0 923
8
2
8
1 923
8
0 1454
8
2
8
0 1730
8
2
8...

result:

points 0.99733333330 points  0.99733333330

Test #81:

score: 74.8
Acceptable Answer
time: 16ms
memory: 3936kb

input:

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

output:

8
0 1425
8
2
8
0 940
8
2
8
0 1308
8
2
8
1 1308
8
0 1846
8
2
8
0 971
8
2
8
0 856
8
2
8
0 706
8
2
8
1 706
8
0 250
8
2
8
0 217
8
2
8
0 1986
8
2
8
0 778
8
2
8
0 481
8
2
8
0 1040
8
2
8
0 1003
8
2
8
0 1278
8
2
8
0 1509
8
2
8
0 950
8
2
8
0 1010
8
2
8
0 58
8
2
8
0 923
8
2
8
1 923
8
0 1454
8
2
8
0 1730
8
2
8...

result:

points 0.99733333330 points  0.99733333330

Test #82:

score: 74.93
Acceptable Answer
time: 10ms
memory: 3916kb

input:

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

output:

8
0 1425
8
2
8
0 940
8
2
8
0 1308
8
2
8
0 1846
8
2
8
0 971
8
2
8
0 856
8
2
8
0 706
8
2
8
0 250
8
2
8
0 217
8
2
8
0 1986
8
2
8
0 778
8
2
8
0 481
8
2
8
0 1040
8
2
8
0 1003
8
2
8
1 1003
8
0 1278
8
2
8
0 1509
8
2
8
1 1509
8
0 950
8
2
8
0 1010
8
2
8
0 58
8
2
8
0 923
8
2
8
1 923
8
0 1454
8
2
8
0 1730
8
2
...

result:

points 0.99906666670 points  0.99906666670

Test #83:

score: 74.93
Acceptable Answer
time: 13ms
memory: 3924kb

input:

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

output:

8
0 1425
8
2
8
0 940
8
2
8
0 1308
8
2
8
0 1846
8
2
8
0 971
8
2
8
0 856
8
2
8
0 706
8
2
8
0 250
8
2
8
0 217
8
2
8
1 217
8
0 1986
8
2
8
0 778
8
2
8
0 481
8
2
8
0 1040
8
2
8
0 1003
8
2
8
1 1003
8
0 1278
8
2
8
0 1509
8
2
8
0 950
8
2
8
0 1010
8
2
8
1 1010
8
0 58
8
2
8
0 923
8
2
8
0 1454
8
2
8
0 1730
8
2
...

result:

points 0.99906666670 points  0.99906666670

Test #84:

score: 45.61
Acceptable Answer
time: 3ms
memory: 3912kb

input:

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

output:

8
0 157
8
2
8
0 391
8
2
8
0 514
8
2
8
1 514
8
0 386
8
2
8
1 386
8
0 76
8
2
8
1 76
8
0 69
8
2
8
1 69
8
0 392
8
2
8
0 128
8
2
8
1 128
8
0 185
8
2
8
1 185
8
0 524
8
2
8
1 524
8
0 230
8
2
8
1 230
8
0 244
8
2
8
1 244
8
0 46
8
2
8
0 469
8
2
8
1 469
8
0 215
8
2
8
1 215
8
0 0
8
2
8
1 0
8
0 295
8
2
8
1 295
8...

result:

points 0.60813333330 points  0.60813333330

Test #85:

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

input:

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

output:

8
0 975
8
2
8
0 932
8
2
8
1 932
8
0 1232
8
2
8
0 1349
8
2
8
1 1349
8
0 1560
8
2
8
1 1560
8
0 1280
8
2
8
1 1280
8
0 722
8
2
8
1 722
8
0 1743
8
2
8
0 1529
8
2
8
1 1529
8
0 631
8
2
8
1 631
8
0 230
8
2
8
1 230
8
0 1789
8
2
8
1 1789
8
0 563
8
2
8
1 563
8
0 1091
8
2
8
1 1091
8
0 215
8
2
8
1 215
8
0 701
8
...

result:

points 0.43040 points  0.43040

Test #86:

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

input:

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

output:

8
0 1916
8
2
8
0 674
8
2
8
1 674
8
0 1055
8
2
8
1 1055
8
0 613
8
2
8
0 1208
8
2
8
1 1208
8
0 1904
8
2
8
1 1904
8
0 996
8
2
8
1 996
8
0 1752
8
2
8
1 1752
8
0 216
8
2
8
1 216
8
0 1313
8
2
8
1 1313
8
0 638
8
2
8
1 638
8
0 1227
8
2
8
1 1227
8
0 1284
8
2
8
1 1284
8
0 1114
8
2
8
1 1114
8
0 1333
8
2
8
1 13...

result:

ok 

Test #87:

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

input:

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

output:

8
0 1916
8
2
8
0 674
8
2
8
0 1055
8
2
8
0 613
8
2
8
1 613
8
0 1208
8
2
8
0 1904
8
2
8
0 996
8
2
8
1 996
8
0 1752
8
2
8
0 216
8
2
8
1 216
8
0 1313
8
2
8
0 638
8
2
8
1 638
8
0 1227
8
2
8
0 1284
8
2
8
0 1114
8
2
8
0 1333
8
2
8
0 94
8
2
8
1 94
8
0 1688
8
2
8
0 1421
8
2
8
0 1569
8
2
8
0 1489
8
2
8
0 1823...

result:

ok 

Test #88:

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

input:

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

output:

8
0 1916
8
2
8
0 674
8
2
8
0 1055
8
2
8
1 1055
8
0 613
8
2
8
0 1208
8
2
8
1 1208
8
0 1904
8
2
8
1 1904
8
0 996
8
2
8
0 1752
8
2
8
1 1752
8
0 216
8
2
8
0 1313
8
2
8
1 1313
8
0 638
8
2
8
0 1227
8
2
8
1 1227
8
0 1284
8
2
8
1 1284
8
0 1114
8
2
8
1 1114
8
0 1333
8
2
8
1 1333
8
0 94
8
2
8
0 1688
8
2
8
1 1...

result:

ok 

Test #89:

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

input:

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

output:

8
0 1916
8
2
8
0 674
8
2
8
0 1055
8
2
8
0 613
8
2
8
0 1208
8
2
8
0 1904
8
2
8
1 1904
8
0 996
8
2
8
0 1752
8
2
8
1 1752
8
0 216
8
2
8
1 216
8
0 1313
8
2
8
0 638
8
2
8
0 1227
8
2
8
0 1284
8
2
8
0 1114
8
2
8
0 1333
8
2
8
0 94
8
2
8
1 94
8
0 1688
8
2
8
1 1688
8
0 1421
8
2
8
0 1569
8
2
8
1 1569
8
0 1489
...

result:

ok