QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#430260#4565. Rarest Insectsjames1BadCreeper63.1 26ms4248kbC++171.9kb2024-06-03 16:48:302024-06-03 16:48:31

Judging History

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

  • [2024-06-03 16:48:31]
  • 评测
  • 测评结果:63.1
  • 用时:26ms
  • 内存:4248kb
  • [2024-06-03 16:48:30]
  • 提交

answer

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

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

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

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

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

int min_cardinality(int N) {
    n = N; 
    k = n; 
    for (int i = 1; i <= n; ++i) always_no[i] = 0, id[i] = i; 
    shuffle(id + 1, id + n + 1, Rand); 
    for (int i = 1; i <= n; ++i) {
        Move_inside(i); 
        if (press_button() > 1) Move_outside(i), --k, arr.emplace_back(i);  
    }
    if (k == 1) return n; 

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

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

详细

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

6
1
1
2
1
2
2
2
3
2

output:

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

result:

ok 

Test #2:

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

input:

2
1
2

output:

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

result:

ok 

Test #3:

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

input:

2
1
1

output:

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

result:

ok 

Test #4:

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

input:

3
1
1
2

output:

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

result:

ok 

Test #5:

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

input:

5
1
1
2
2
2
2
2

output:

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

result:

ok 

Test #6:

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

input:

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

output:

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

result:

ok 

Test #7:

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

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 13
8
2
8
0 49
8
2
8
1 49
8
0 26
8
2
8
1 26
8
0 57
8
2
8
1 57
8
0 29
8
2
8
1 29
8
0 106
8
2
8
1 106
8
0 37
8
2
8
1 37
8
0 182
8
2
8
1 182
8
0 55
8
2
8
1 55
8
0 83
8
2
8
1 83
8
0 53
8
2
8
1 53
8
0 31
8
2
8
1 31
8
0 16
8
2
8
1 16
8
0 157
8
2
8
1 157
8
0 33
8
2
8
1 33
8
0 97
8
2
8
1 97
8
0 9
8
2
8
1...

result:

ok 

Test #8:

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

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 139
8
2
8
0 48
8
2
8
0 69
8
2
8
0 56
8
2
8
0 28
8
2
8
0 62
8
2
8
0 36
8
2
8
0 129
8
2
8
0 54
8
2
8
0 82
8
2
8
0 123
8
2
8
0 30
8
2
8
0 17
8
2
8
0 156
8
2
8
0 51
8
2
8
0 96
8
2
8
0 73
8
2
8
0 0
8
2
8
0 143
8
2
8
0 114
8
2
8
0 173
8
2
8
0 113
8
2
8
0 128
8
2
8
0 95
8
2
8
0 151
8
2
8
0 197
8
2
8
0 ...

result:

ok 

Test #9:

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

input:

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

output:

8
0 139
8
2
8
0 48
8
2
8
0 69
8
2
8
0 56
8
2
8
0 28
8
2
8
0 62
8
2
8
0 36
8
2
8
1 36
8
0 129
8
2
8
0 54
8
2
8
1 54
8
0 82
8
2
8
0 123
8
2
8
1 123
8
0 30
8
2
8
1 30
8
0 17
8
2
8
0 156
8
2
8
1 156
8
0 51
8
2
8
1 51
8
0 96
8
2
8
0 73
8
2
8
1 73
8
0 0
8
2
8
1 0
8
0 143
8
2
8
1 143
8
0 114
8
2
8
1 114
8
...

result:

ok 

Test #10:

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

input:

198
1
1
1
2
1
1
1
2
1
2
2
1
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
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 139
8
2
8
0 48
8
2
8
0 69
8
2
8
0 56
8
2
8
1 56
8
0 28
8
2
8
0 62
8
2
8
0 36
8
2
8
0 129
8
2
8
1 129
8
0 54
8
2
8
0 82
8
2
8
1 82
8
0 123
8
2
8
1 123
8
0 30
8
2
8
0 17
8
2
8
1 17
8
0 156
8
2
8
0 51
8
2
8
1 51
8
0 96
8
2
8
0 73
8
2
8
0 0
8
2
8
1 0
8
0 143
8
2
8
1 143
8
0 114
8
2
8
1 114
8
0 173
8...

result:

ok 

Test #11:

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

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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 13
8
2
8
0 49
8
2
8
1 49
8
0 26
8
2
8
1 26
8
0 57
8
2
8
1 57
8
0 29
8
2
8
1 29
8
0 106
8
2
8
1 106
8
0 37
8
2
8
1 37
8
0 182
8
2
8
1 182
8
0 55
8
2
8
1 55
8
0 83
8
2
8
1 83
8
0 53
8
2
8
1 53
8
0 31
8
2
8
1 31
8
0 16
8
2
8
1 16
8
0 157
8
2
8
1 157
8
0 33
8
2
8
1 33
8
0 97
8
2
8
1 97
8
0 9
8
2
8
1...

result:

ok 

Test #12:

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

input:

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

output:

8
0 13
8
2
8
0 49
8
2
8
0 26
8
2
8
1 26
8
0 57
8
2
8
0 29
8
2
8
1 29
8
0 106
8
2
8
0 37
8
2
8
1 37
8
0 182
8
2
8
1 182
8
0 55
8
2
8
1 55
8
0 83
8
2
8
1 83
8
0 53
8
2
8
1 53
8
0 31
8
2
8
0 16
8
2
8
1 16
8
0 157
8
2
8
0 33
8
2
8
0 97
8
2
8
1 97
8
0 9
8
2
8
1 9
8
0 8
8
2
8
0 146
8
2
8
0 136
8
2
8
1 136...

result:

ok 

Test #13:

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

input:

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

output:

8
0 13
8
2
8
0 49
8
2
8
1 49
8
0 26
8
2
8
0 57
8
2
8
1 57
8
0 29
8
2
8
1 29
8
0 106
8
2
8
0 37
8
2
8
1 37
8
0 182
8
2
8
1 182
8
0 55
8
2
8
1 55
8
0 83
8
2
8
1 83
8
0 53
8
2
8
1 53
8
0 31
8
2
8
1 31
8
0 16
8
2
8
0 157
8
2
8
1 157
8
0 33
8
2
8
1 33
8
0 97
8
2
8
1 97
8
0 9
8
2
8
1 9
8
0 8
8
2
8
1 8
8
0...

result:

ok 

Test #14:

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

input:

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

output:

8
0 139
8
2
8
0 48
8
2
8
1 48
8
0 69
8
2
8
1 69
8
0 56
8
2
8
0 28
8
2
8
0 62
8
2
8
1 62
8
0 36
8
2
8
0 129
8
2
8
1 129
8
0 54
8
2
8
1 54
8
0 82
8
2
8
1 82
8
0 123
8
2
8
0 30
8
2
8
1 30
8
0 17
8
2
8
0 156
8
2
8
1 156
8
0 51
8
2
8
1 51
8
0 96
8
2
8
1 96
8
0 73
8
2
8
0 0
8
2
8
1 0
8
0 143
8
2
8
1 143
8...

result:

ok 

Test #15:

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

input:

200
1
1
2
1
2
2
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 139
8
2
8
0 48
8
2
8
0 69
8
2
8
1 69
8
0 56
8
2
8
0 28
8
2
8
1 28
8
0 62
8
2
8
1 62
8
0 36
8
2
8
1 36
8
0 129
8
2
8
0 54
8
2
8
1 54
8
0 82
8
2
8
1 82
8
0 123
8
2
8
1 123
8
0 30
8
2
8
1 30
8
0 17
8
2
8
1 17
8
0 156
8
2
8
1 156
8
0 51
8
2
8
0 96
8
2
8
1 96
8
0 73
8
2
8
1 73
8
0 0
8
2
8
1 0
8
0 143...

result:

ok 

Test #16:

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

input:

196
1
1
1
2
1
2
1
1
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 139
8
2
8
0 48
8
2
8
0 69
8
2
8
0 56
8
2
8
1 56
8
0 28
8
2
8
0 62
8
2
8
1 62
8
0 36
8
2
8
0 129
8
2
8
0 54
8
2
8
1 54
8
0 82
8
2
8
0 123
8
2
8
1 123
8
0 30
8
2
8
0 17
8
2
8
1 17
8
0 156
8
2
8
1 156
8
0 51
8
2
8
1 51
8
0 96
8
2
8
1 96
8
0 73
8
2
8
1 73
8
0 0
8
2
8
1 0
8
0 143
8
2
8
1 143
8
0 114
...

result:

ok 

Test #17:

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

input:

199
1
1
1
2
1
1
2
1
2
2
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 13
8
2
8
0 49
8
2
8
0 26
8
2
8
0 57
8
2
8
1 57
8
0 29
8
2
8
0 106
8
2
8
0 37
8
2
8
1 37
8
0 182
8
2
8
0 55
8
2
8
1 55
8
0 83
8
2
8
1 83
8
0 53
8
2
8
1 53
8
0 31
8
2
8
0 16
8
2
8
1 16
8
0 157
8
2
8
1 157
8
0 33
8
2
8
1 33
8
0 97
8
2
8
1 97
8
0 9
8
2
8
1 9
8
0 8
8
2
8
1 8
8
0 146
8
2
8
1 146
8
0 1...

result:

ok 

Test #18:

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

input:

196
1
1
1
1
1
2
1
1
1
2
1
2
1
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 139
8
2
8
0 48
8
2
8
0 69
8
2
8
0 56
8
2
8
0 28
8
2
8
0 62
8
2
8
1 62
8
0 36
8
2
8
0 129
8
2
8
0 54
8
2
8
0 82
8
2
8
1 82
8
0 123
8
2
8
0 30
8
2
8
1 30
8
0 17
8
2
8
0 156
8
2
8
1 156
8
0 51
8
2
8
1 51
8
0 96
8
2
8
0 73
8
2
8
1 73
8
0 0
8
2
8
1 0
8
0 143
8
2
8
1 143
8
0 114
8
2
8
1 114
8
0 173
8
...

result:

ok 

Test #19:

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

input:

196
1
1
2
1
1
1
2
1
2
1
1
2
2
2
1
2
2
2
2
2
1
2
2
1
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 139
8
2
8
0 48
8
2
8
0 69
8
2
8
1 69
8
0 56
8
2
8
0 28
8
2
8
0 62
8
2
8
0 36
8
2
8
1 36
8
0 129
8
2
8
0 54
8
2
8
1 54
8
0 82
8
2
8
0 123
8
2
8
0 30
8
2
8
1 30
8
0 17
8
2
8
1 17
8
0 156
8
2
8
1 156
8
0 51
8
2
8
0 96
8
2
8
1 96
8
0 73
8
2
8
1 73
8
0 0
8
2
8
1 0
8
0 143
8
2
8
1 143
8
0 114
8
2
8
1 ...

result:

ok 

Test #20:

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

input:

196
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 139
8
2
8
0 48
8
2
8
0 69
8
2
8
0 56
8
2
8
0 28
8
2
8
0 62
8
2
8
0 36
8
2
8
0 129
8
2
8
0 54
8
2
8
1 54
8
0 82
8
2
8
0 123
8
2
8
0 30
8
2
8
0 17
8
2
8
0 156
8
2
8
0 51
8
2
8
0 96
8
2
8
0 73
8
2
8
1 73
8
0 0
8
2
8
1 0
8
0 143
8
2
8
1 143
8
0 114
8
2
8
0 173
8
2
8
1 173
8
0 113
8
2
8
1 113
8
0 128...

result:

ok 

Test #21:

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

input:

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

output:

8
0 139
8
2
8
0 48
8
2
8
0 69
8
2
8
0 56
8
2
8
0 28
8
2
8
1 28
8
0 62
8
2
8
0 36
8
2
8
0 129
8
2
8
0 54
8
2
8
0 82
8
2
8
0 123
8
2
8
0 30
8
2
8
1 30
8
0 17
8
2
8
0 156
8
2
8
1 156
8
0 51
8
2
8
1 51
8
0 96
8
2
8
0 73
8
2
8
0 0
8
2
8
0 143
8
2
8
0 114
8
2
8
0 173
8
2
8
0 113
8
2
8
0 128
8
2
8
1 128
8
...

result:

ok 

Test #22:

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

input:

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

output:

8
0 13
8
2
8
0 49
8
2
8
0 26
8
2
8
0 57
8
2
8
0 29
8
2
8
0 106
8
2
8
0 37
8
2
8
0 182
8
2
8
0 55
8
2
8
0 83
8
2
8
1 83
8
0 53
8
2
8
0 31
8
2
8
0 16
8
2
8
1 16
8
0 157
8
2
8
0 33
8
2
8
0 97
8
2
8
0 9
8
2
8
0 8
8
2
8
0 146
8
2
8
0 136
8
2
8
1 136
8
0 48
8
2
8
0 76
8
2
8
0 129
8
2
8
0 46
8
2
8
0 71
8
2...

result:

ok 

Test #23:

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

input:

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

output:

8
0 139
8
2
8
0 48
8
2
8
0 69
8
2
8
0 56
8
2
8
0 28
8
2
8
0 62
8
2
8
0 36
8
2
8
0 129
8
2
8
0 54
8
2
8
0 82
8
2
8
0 123
8
2
8
0 30
8
2
8
0 17
8
2
8
1 17
8
0 156
8
2
8
0 51
8
2
8
0 96
8
2
8
0 73
8
2
8
0 0
8
2
8
0 143
8
2
8
0 114
8
2
8
0 173
8
2
8
0 113
8
2
8
0 128
8
2
8
0 95
8
2
8
0 151
8
2
8
0 197
8...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

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

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 677
8
2
8
0 215
8
2
8
1 215
8
0 69
8
2
8
1 69
8
0 643
8
2
8
1 643
8
0 28
8
2
8
1 28
8
0 312
8
2
8
1 312
8
0 633
8
2
8
1 633
8
0 406
8
2
8
1 406
8
0 951
8
2
8
1 951
8
0 960
8
2
8
1 960
8
0 953
8
2
8
1 953
8
0 857
8
2
8
1 857
8
0 351
8
2
8
1 351
8
0 156
8
2
8
1 156
8
0 698
8
2
8
1 698
8
0 568
8
2
...

result:

ok 

Test #25:

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

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 677
8
2
8
0 215
8
2
8
0 69
8
2
8
0 643
8
2
8
0 28
8
2
8
0 312
8
2
8
0 633
8
2
8
0 406
8
2
8
0 951
8
2
8
0 960
8
2
8
0 953
8
2
8
0 857
8
2
8
0 351
8
2
8
0 156
8
2
8
0 698
8
2
8
0 568
8
2
8
0 445
8
2
8
0 320
8
2
8
0 833
8
2
8
0 862
8
2
8
0 258
8
2
8
0 729
8
2
8
0 585
8
2
8
0 95
8
2
8
0 892
8
2
8
0...

result:

ok 

Test #26:

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

input:

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

output:

8
0 914
8
2
8
0 49
8
2
8
0 942
8
2
8
0 326
8
2
8
0 536
8
2
8
0 313
8
2
8
0 786
8
2
8
0 407
8
2
8
0 295
8
2
8
0 961
8
2
8
0 53
8
2
8
0 717
8
2
8
1 717
8
0 16
8
2
8
1 16
8
0 157
8
2
8
0 699
8
2
8
1 699
8
0 569
8
2
8
1 569
8
0 912
8
2
8
0 342
8
2
8
0 385
8
2
8
0 863
8
2
8
0 584
8
2
8
1 584
8
0 792
8
2
...

result:

ok 

Test #27:

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

input:

999
1
1
1
2
1
1
1
1
2
2
1
1
1
1
2
1
1
1
1
1
2
1
1
1
2
2
2
2
2
1
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
2
2
2
2
2
1
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
1
2
2
2
2
2
2
...

output:

8
0 914
8
2
8
0 49
8
2
8
0 942
8
2
8
0 326
8
2
8
1 326
8
0 536
8
2
8
0 313
8
2
8
0 786
8
2
8
0 407
8
2
8
0 295
8
2
8
1 295
8
0 961
8
2
8
1 961
8
0 53
8
2
8
0 717
8
2
8
0 16
8
2
8
0 157
8
2
8
0 699
8
2
8
1 699
8
0 569
8
2
8
0 912
8
2
8
0 342
8
2
8
0 385
8
2
8
0 863
8
2
8
0 584
8
2
8
1 584
8
0 792
8
2...

result:

ok 

Test #28:

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

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 677
8
2
8
0 215
8
2
8
1 215
8
0 69
8
2
8
1 69
8
0 643
8
2
8
1 643
8
0 28
8
2
8
1 28
8
0 312
8
2
8
1 312
8
0 633
8
2
8
1 633
8
0 406
8
2
8
1 406
8
0 951
8
2
8
1 951
8
0 960
8
2
8
1 960
8
0 953
8
2
8
1 953
8
0 857
8
2
8
1 857
8
0 351
8
2
8
1 351
8
0 156
8
2
8
1 156
8
0 698
8
2
8
1 698
8
0 568
8
2
...

result:

ok 

Test #29:

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

input:

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

output:

8
0 69
8
2
8
0 296
8
2
8
0 609
8
2
8
0 802
8
2
8
1 802
8
0 246
8
2
8
1 246
8
0 215
8
2
8
1 215
8
0 64
8
2
8
0 985
8
2
8
1 985
8
0 438
8
2
8
0 293
8
2
8
1 293
8
0 902
8
2
8
0 904
8
2
8
0 424
8
2
8
1 424
8
0 85
8
2
8
0 378
8
2
8
1 378
8
0 267
8
2
8
1 267
8
0 450
8
2
8
1 450
8
0 25
8
2
8
0 780
8
2
8
1 ...

result:

ok 

Test #30:

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

input:

998
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 497
8
2
8
0 109
8
2
8
0 608
8
2
8
1 608
8
0 141
8
2
8
1 141
8
0 10
8
2
8
1 10
8
0 447
8
2
8
1 447
8
0 31
8
2
8
0 984
8
2
8
1 984
8
0 481
8
2
8
1 481
8
0 292
8
2
8
1 292
8
0 765
8
2
8
0 187
8
2
8
1 187
8
0 148
8
2
8
1 148
8
0 513
8
2
8
1 513
8
0 731
8
2
8
1 731
8
0 525
8
2
8
1 525
8
0 613
8
2
8
1...

result:

ok 

Test #31:

score: 0
Accepted
time: 11ms
memory: 3796kb

input:

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

output:

8
0 497
8
2
8
0 109
8
2
8
0 608
8
2
8
0 141
8
2
8
0 10
8
2
8
1 10
8
0 447
8
2
8
0 31
8
2
8
0 984
8
2
8
0 481
8
2
8
1 481
8
0 292
8
2
8
0 765
8
2
8
1 765
8
0 187
8
2
8
1 187
8
0 148
8
2
8
0 513
8
2
8
1 513
8
0 731
8
2
8
1 731
8
0 525
8
2
8
0 613
8
2
8
0 59
8
2
8
0 309
8
2
8
0 956
8
2
8
1 956
8
0 890
...

result:

ok 

Test #32:

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

input:

1000
1
1
1
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 497
8
2
8
0 109
8
2
8
0 608
8
2
8
0 141
8
2
8
1 141
8
0 10
8
2
8
1 10
8
0 447
8
2
8
1 447
8
0 31
8
2
8
1 31
8
0 984
8
2
8
1 984
8
0 481
8
2
8
1 481
8
0 292
8
2
8
0 765
8
2
8
1 765
8
0 187
8
2
8
1 187
8
0 148
8
2
8
1 148
8
0 513
8
2
8
0 731
8
2
8
1 731
8
0 525
8
2
8
1 525
8
0 613
8
2
8
1 613
8
0 ...

result:

ok 

Test #33:

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

input:

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

output:

8
0 497
8
2
8
0 109
8
2
8
0 608
8
2
8
0 141
8
2
8
1 141
8
0 10
8
2
8
1 10
8
0 447
8
2
8
0 31
8
2
8
0 984
8
2
8
1 984
8
0 481
8
2
8
1 481
8
0 292
8
2
8
1 292
8
0 765
8
2
8
0 187
8
2
8
0 148
8
2
8
1 148
8
0 513
8
2
8
1 513
8
0 731
8
2
8
0 525
8
2
8
1 525
8
0 613
8
2
8
1 613
8
0 59
8
2
8
1 59
8
0 309
8...

result:

ok 

Test #34:

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

input:

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

output:

8
0 497
8
2
8
0 109
8
2
8
0 608
8
2
8
0 141
8
2
8
0 10
8
2
8
0 447
8
2
8
0 31
8
2
8
1 31
8
0 984
8
2
8
1 984
8
0 481
8
2
8
0 292
8
2
8
0 765
8
2
8
1 765
8
0 187
8
2
8
1 187
8
0 148
8
2
8
1 148
8
0 513
8
2
8
0 731
8
2
8
1 731
8
0 525
8
2
8
1 525
8
0 613
8
2
8
0 59
8
2
8
1 59
8
0 309
8
2
8
1 309
8
0 9...

result:

ok 

Test #35:

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

input:

1000
1
1
2
1
1
1
1
2
2
2
2
2
2
1
1
2
2
2
2
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 497
8
2
8
0 109
8
2
8
0 608
8
2
8
1 608
8
0 141
8
2
8
0 10
8
2
8
0 447
8
2
8
0 31
8
2
8
0 984
8
2
8
1 984
8
0 481
8
2
8
1 481
8
0 292
8
2
8
1 292
8
0 765
8
2
8
1 765
8
0 187
8
2
8
1 187
8
0 148
8
2
8
1 148
8
0 513
8
2
8
0 731
8
2
8
0 525
8
2
8
1 525
8
0 613
8
2
8
1 613
8
0 59
8
2
8
1 59
8
0 309
...

result:

ok 

Test #36:

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

input:

997
1
1
1
1
2
1
1
2
2
2
2
1
1
1
1
2
1
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 69
8
2
8
0 296
8
2
8
0 609
8
2
8
0 802
8
2
8
0 246
8
2
8
1 246
8
0 215
8
2
8
0 64
8
2
8
0 985
8
2
8
1 985
8
0 438
8
2
8
1 438
8
0 293
8
2
8
1 293
8
0 902
8
2
8
1 902
8
0 904
8
2
8
0 424
8
2
8
0 85
8
2
8
0 378
8
2
8
0 267
8
2
8
1 267
8
0 450
8
2
8
0 25
8
2
8
1 25
8
0 780
8
2
8
0 978
8
2
8
0 891
8...

result:

ok 

Test #37:

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

input:

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

output:

8
0 344
8
2
8
0 556
8
2
8
0 190
8
2
8
0 787
8
2
8
0 186
8
2
8
0 993
8
2
8
0 935
8
2
8
0 763
8
2
8
0 488
8
2
8
0 19
8
2
8
1 19
8
0 527
8
2
8
0 234
8
2
8
1 234
8
0 785
8
2
8
1 785
8
0 149
8
2
8
0 235
8
2
8
1 235
8
0 526
8
2
8
0 837
8
2
8
1 837
8
0 892
8
2
8
0 874
8
2
8
1 874
8
0 651
8
2
8
0 274
8
2
8
...

result:

ok 

Test #38:

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

input:

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

output:

8
0 344
8
2
8
0 556
8
2
8
0 190
8
2
8
0 787
8
2
8
0 186
8
2
8
0 993
8
2
8
0 935
8
2
8
0 763
8
2
8
0 488
8
2
8
0 19
8
2
8
1 19
8
0 527
8
2
8
0 234
8
2
8
0 785
8
2
8
1 785
8
0 149
8
2
8
0 235
8
2
8
1 235
8
0 526
8
2
8
0 837
8
2
8
0 892
8
2
8
1 892
8
0 874
8
2
8
0 651
8
2
8
0 274
8
2
8
0 671
8
2
8
0 60...

result:

ok 

Test #39:

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

input:

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

output:

8
0 344
8
2
8
0 556
8
2
8
0 190
8
2
8
0 787
8
2
8
0 186
8
2
8
1 186
8
0 993
8
2
8
0 935
8
2
8
0 763
8
2
8
0 488
8
2
8
0 19
8
2
8
1 19
8
0 527
8
2
8
0 234
8
2
8
0 785
8
2
8
0 149
8
2
8
1 149
8
0 235
8
2
8
0 526
8
2
8
0 837
8
2
8
0 892
8
2
8
0 874
8
2
8
0 651
8
2
8
0 274
8
2
8
0 671
8
2
8
1 671
8
0 60...

result:

ok 

Test #40:

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

input:

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

output:

8
0 755
8
2
8
0 549
8
2
8
0 767
8
2
8
0 795
8
2
8
0 779
8
2
8
0 992
8
2
8
0 934
8
2
8
0 762
8
2
8
0 883
8
2
8
0 18
8
2
8
0 526
8
2
8
0 427
8
2
8
0 784
8
2
8
0 511
8
2
8
0 407
8
2
8
0 179
8
2
8
0 836
8
2
8
0 881
8
2
8
1 881
8
0 77
8
2
8
0 650
8
2
8
0 621
8
2
8
0 670
8
2
8
0 218
8
2
8
0 733
8
2
8
0 57...

result:

ok 

Test #41:

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

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

output:

8
0 344
8
2
8
0 556
8
2
8
0 190
8
2
8
0 787
8
2
8
0 186
8
2
8
0 993
8
2
8
0 935
8
2
8
0 763
8
2
8
0 488
8
2
8
0 19
8
2
8
0 527
8
2
8
0 234
8
2
8
0 785
8
2
8
0 149
8
2
8
0 235
8
2
8
0 526
8
2
8
0 837
8
2
8
0 892
8
2
8
0 874
8
2
8
0 651
8
2
8
0 274
8
2
8
0 671
8
2
8
0 608
8
2
8
0 733
8
2
8
0 21
8
2
8
...

result:

ok 

Test #42:

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

input:

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

output:

8
0 344
8
2
8
0 556
8
2
8
0 190
8
2
8
0 787
8
2
8
0 186
8
2
8
1 186
8
0 993
8
2
8
0 935
8
2
8
0 763
8
2
8
0 488
8
2
8
0 19
8
2
8
0 527
8
2
8
0 234
8
2
8
0 785
8
2
8
0 149
8
2
8
0 235
8
2
8
0 526
8
2
8
0 837
8
2
8
0 892
8
2
8
0 874
8
2
8
0 651
8
2
8
0 274
8
2
8
1 274
8
0 671
8
2
8
0 608
8
2
8
1 608
8...

result:

ok 

Subtask #3:

score: 38.1
Acceptable Answer

Test #43:

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

input:

2
1
2

output:

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

result:

ok 

Test #44:

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

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: 0ms
memory: 3812kb

input:

3
1
1
2

output:

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

result:

ok 

Test #46:

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

input:

6
1
1
2
2
2
2
2
3
3
3

output:

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

result:

ok 

Test #47:

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

input:

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

output:

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

result:

ok 

Test #48:

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

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 755
8
2
8
0 549
8
2
8
1 549
8
0 1195
8
2
8
1 1195
8
0 795
8
2
8
1 795
8
0 1458
8
2
8
1 1458
8
0 992
8
2
8
1 992
8
0 1474
8
2
8
1 1474
8
0 762
8
2
8
1 762
8
0 1558
8
2
8
1 1558
8
0 18
8
2
8
1 18
8
0 1374
8
2
8
1 1374
8
0 1818
8
2
8
1 1818
8
0 784
8
2
8
1 784
8
0 1002
8
2
8
1 1002
8
0 407
8
2
8
1 ...

result:

ok 

Test #49:

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

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 755
8
2
8
0 549
8
2
8
0 1195
8
2
8
0 795
8
2
8
0 1458
8
2
8
0 992
8
2
8
0 1474
8
2
8
0 762
8
2
8
0 1558
8
2
8
0 18
8
2
8
0 1374
8
2
8
0 1818
8
2
8
0 784
8
2
8
0 1002
8
2
8
0 407
8
2
8
0 1485
8
2
8
0 836
8
2
8
0 1292
8
2
8
0 1099
8
2
8
0 1425
8
2
8
0 621
8
2
8
0 1044
8
2
8
0 218
8
2
8
0 733
8
2
8...

result:

ok 

Test #50:

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

input:

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

output:

8
0 755
8
2
8
0 549
8
2
8
0 1195
8
2
8
0 795
8
2
8
0 1458
8
2
8
0 992
8
2
8
1 992
8
0 1474
8
2
8
0 762
8
2
8
0 1558
8
2
8
0 18
8
2
8
0 1374
8
2
8
0 1818
8
2
8
0 784
8
2
8
0 1002
8
2
8
0 407
8
2
8
1 407
8
0 1485
8
2
8
0 836
8
2
8
0 1292
8
2
8
0 1099
8
2
8
1 1099
8
0 1425
8
2
8
0 621
8
2
8
0 1044
8
2
...

result:

ok 

Test #51:

score: 70.6
Acceptable Answer
time: 19ms
memory: 4236kb

input:

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

output:

8
0 755
8
2
8
0 549
8
2
8
0 1195
8
2
8
0 795
8
2
8
0 1458
8
2
8
0 992
8
2
8
0 1474
8
2
8
1 1474
8
0 762
8
2
8
0 1558
8
2
8
1 1558
8
0 18
8
2
8
0 1374
8
2
8
0 1818
8
2
8
0 784
8
2
8
0 1002
8
2
8
0 407
8
2
8
1 407
8
0 1485
8
2
8
0 836
8
2
8
0 1292
8
2
8
0 1099
8
2
8
0 1425
8
2
8
0 621
8
2
8
1 621
8
0 ...

result:

points 0.94133333330 points  0.94133333330

Test #52:

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

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 1864
8
2
8
0 48
8
2
8
1 48
8
0 527
8
2
8
1 527
8
0 658
8
2
8
1 658
8
0 304
8
2
8
1 304
8
0 861
8
2
8
1 861
8
0 438
8
2
8
1 438
8
0 67
8
2
8
1 67
8
0 840
8
2
8
1 840
8
0 1076
8
2
8
1 1076
8
0 395
8
2
8
1 395
8
0 379
8
2
8
1 379
8
0 166
8
2
8
1 166
8
0 751
8
2
8
1 751
8
0 803
8
2
8
1 803
8
0 37
8
...

result:

points 0.60066666670 points  0.60066666670

Test #53:

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

input:

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

output:

8
0 1864
8
2
8
0 48
8
2
8
1 48
8
0 527
8
2
8
1 527
8
0 658
8
2
8
1 658
8
0 304
8
2
8
0 861
8
2
8
0 438
8
2
8
1 438
8
0 67
8
2
8
0 840
8
2
8
0 1076
8
2
8
0 395
8
2
8
0 379
8
2
8
1 379
8
0 166
8
2
8
1 166
8
0 751
8
2
8
0 803
8
2
8
0 37
8
2
8
0 1920
8
2
8
0 1042
8
2
8
0 1641
8
2
8
0 1568
8
2
8
0 1068
8...

result:

ok 

Test #54:

score: 38.1
Acceptable Answer
time: 19ms
memory: 4216kb

input:

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

output:

8
0 1864
8
2
8
0 48
8
2
8
0 527
8
2
8
1 527
8
0 658
8
2
8
0 304
8
2
8
0 861
8
2
8
1 861
8
0 438
8
2
8
1 438
8
0 67
8
2
8
1 67
8
0 840
8
2
8
1 840
8
0 1076
8
2
8
1 1076
8
0 395
8
2
8
1 395
8
0 379
8
2
8
1 379
8
0 166
8
2
8
1 166
8
0 751
8
2
8
1 751
8
0 803
8
2
8
1 803
8
0 37
8
2
8
1 37
8
0 1920
8
2
8...

result:

points 0.5080 points  0.5080

Test #55:

score: 57.87
Acceptable Answer
time: 26ms
memory: 4216kb

input:

2000
1
1
1
1
1
1
1
1
1
1
2
1
1
2
1
1
2
2
1
1
1
1
2
1
2
1
1
2
1
1
1
2
2
1
2
1
1
2
2
1
1
2
2
2
1
2
1
2
2
2
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
2
2
2
2
2
2
1
2
2
2
1
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
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 90
8
2
8
0 1651
8
2
8
0 1207
8
2
8
0 1117
8
2
8
0 540
8
2
8
0 1459
8
2
8
0 270
8
2
8
0 759
8
2
8
0 766
8
2
8
0 442
8
2
8
0 576
8
2
8
1 576
8
0 1588
8
2
8
0 744
8
2
8
0 1376
8
2
8
1 1376
8
0 1823
8
2
8
0 314
8
2
8
0 310
8
2
8
1 310
8
0 1053
8
2
8
1 1053
8
0 1212
8
2
8
0 1836
8
2
8
0 678
8
2
8
0 1...

result:

points 0.77160 points  0.77160

Test #56:

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

input:

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

output:

8
0 90
8
2
8
0 1651
8
2
8
0 1207
8
2
8
0 1117
8
2
8
1 1117
8
0 540
8
2
8
1 540
8
0 1459
8
2
8
1 1459
8
0 270
8
2
8
0 759
8
2
8
1 759
8
0 766
8
2
8
1 766
8
0 442
8
2
8
0 576
8
2
8
1 576
8
0 1588
8
2
8
1 1588
8
0 744
8
2
8
1 744
8
0 1376
8
2
8
1 1376
8
0 1823
8
2
8
1 1823
8
0 314
8
2
8
1 314
8
0 310
8...

result:

ok 

Test #57:

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

input:

1999
1
1
1
2
1
1
2
2
1
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 91
8
2
8
0 1331
8
2
8
0 530
8
2
8
0 299
8
2
8
1 299
8
0 616
8
2
8
0 1092
8
2
8
0 271
8
2
8
1 271
8
0 1116
8
2
8
1 1116
8
0 978
8
2
8
0 1174
8
2
8
1 1174
8
0 577
8
2
8
1 577
8
0 1589
8
2
8
1 1589
8
0 745
8
2
8
1 745
8
0 1416
8
2
8
1 1416
8
0 1329
8
2
8
1 1329
8
0 315
8
2
8
1 315
8
0 1828
8
2
8
0 ...

result:

ok 

Test #58:

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

input:

1997
1
1
2
1
1
2
1
1
1
2
2
2
1
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1719
8
2
8
0 1625
8
2
8
0 1648
8
2
8
1 1648
8
0 1843
8
2
8
0 1188
8
2
8
0 906
8
2
8
1 906
8
0 157
8
2
8
0 1134
8
2
8
0 46
8
2
8
0 666
8
2
8
1 666
8
0 1195
8
2
8
1 1195
8
0 1862
8
2
8
1 1862
8
0 380
8
2
8
0 1564
8
2
8
0 636
8
2
8
1 636
8
0 1366
8
2
8
0 1361
8
2
8
1 1361
8
0 190
8
2
8
1 190
8
0 14...

result:

ok 

Test #59:

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

input:

1998
1
1
1
1
1
1
2
1
1
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1718
8
2
8
0 1624
8
2
8
0 1166
8
2
8
0 1842
8
2
8
0 745
8
2
8
0 242
8
2
8
0 1587
8
2
8
1 1587
8
0 1023
8
2
8
0 1981
8
2
8
0 462
8
2
8
1 462
8
0 1194
8
2
8
1 1194
8
0 962
8
2
8
1 962
8
0 13
8
2
8
0 1391
8
2
8
1 1391
8
0 1423
8
2
8
1 1423
8
0 591
8
2
8
0 1360
8
2
8
0 643
8
2
8
0 1307
8
2
8
1 1307
...

result:

ok 

Test #60:

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

input:

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

output:

8
0 1718
8
2
8
0 1624
8
2
8
0 1166
8
2
8
0 1842
8
2
8
1 1842
8
0 745
8
2
8
0 242
8
2
8
0 1587
8
2
8
0 1023
8
2
8
1 1023
8
0 1981
8
2
8
0 462
8
2
8
1 462
8
0 1194
8
2
8
1 1194
8
0 962
8
2
8
0 13
8
2
8
1 13
8
0 1391
8
2
8
1 1391
8
0 1423
8
2
8
0 591
8
2
8
0 1360
8
2
8
1 1360
8
0 643
8
2
8
0 1307
8
2
8...

result:

ok 

Test #61:

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

input:

2000
1
1
1
1
1
1
1
2
1
1
2
1
1
2
1
1
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1718
8
2
8
0 1624
8
2
8
0 1166
8
2
8
0 1842
8
2
8
0 745
8
2
8
0 242
8
2
8
0 1587
8
2
8
0 1023
8
2
8
1 1023
8
0 1981
8
2
8
0 462
8
2
8
0 1194
8
2
8
1 1194
8
0 962
8
2
8
0 13
8
2
8
0 1391
8
2
8
1 1391
8
0 1423
8
2
8
0 591
8
2
8
0 1360
8
2
8
1 1360
8
0 643
8
2
8
0 1307
8
2
8
1 1307
8
0 1008
8
2
8
1...

result:

ok 

Test #62:

score: 72.94
Acceptable Answer
time: 16ms
memory: 3984kb

input:

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

output:

8
0 1718
8
2
8
0 1624
8
2
8
0 1166
8
2
8
0 1842
8
2
8
0 745
8
2
8
0 242
8
2
8
0 1587
8
2
8
0 1023
8
2
8
1 1023
8
0 1981
8
2
8
0 462
8
2
8
0 1194
8
2
8
0 962
8
2
8
0 13
8
2
8
0 1391
8
2
8
0 1423
8
2
8
1 1423
8
0 591
8
2
8
0 1360
8
2
8
1 1360
8
0 643
8
2
8
0 1307
8
2
8
0 1008
8
2
8
0 911
8
2
8
1 911
8...

result:

points 0.97253333330 points  0.97253333330

Test #63:

score: 71.77
Acceptable Answer
time: 3ms
memory: 3964kb

input:

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

output:

8
0 1768
8
2
8
0 720
8
2
8
0 1262
8
2
8
0 681
8
2
8
0 821
8
2
8
0 1912
8
2
8
1 1912
8
0 1151
8
2
8
0 450
8
2
8
0 1659
8
2
8
0 1095
8
2
8
0 943
8
2
8
0 1832
8
2
8
0 1491
8
2
8
0 921
8
2
8
0 1195
8
2
8
0 1280
8
2
8
0 1007
8
2
8
0 476
8
2
8
0 722
8
2
8
0 1247
8
2
8
0 1513
8
2
8
1 1513
8
0 173
8
2
8
0 1...

result:

points 0.95693333330 points  0.95693333330

Test #64:

score: 71.88
Acceptable Answer
time: 10ms
memory: 3960kb

input:

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

output:

8
0 1769
8
2
8
0 1256
8
2
8
0 1278
8
2
8
0 1070
8
2
8
0 948
8
2
8
0 1913
8
2
8
0 1010
8
2
8
0 451
8
2
8
0 1059
8
2
8
0 1690
8
2
8
0 1036
8
2
8
0 1833
8
2
8
0 1437
8
2
8
0 258
8
2
8
0 938
8
2
8
0 1734
8
2
8
0 1946
8
2
8
1 1946
8
0 477
8
2
8
0 1562
8
2
8
0 1358
8
2
8
0 877
8
2
8
0 48
8
2
8
0 1527
8
2
...

result:

points 0.95840 points  0.95840

Test #65:

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

input:

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

output:

8
0 1769
8
2
8
0 1256
8
2
8
0 1278
8
2
8
0 1070
8
2
8
0 948
8
2
8
0 1913
8
2
8
0 1010
8
2
8
0 451
8
2
8
0 1059
8
2
8
0 1690
8
2
8
0 1036
8
2
8
0 1833
8
2
8
0 1437
8
2
8
0 258
8
2
8
0 938
8
2
8
0 1734
8
2
8
0 1946
8
2
8
0 477
8
2
8
0 1562
8
2
8
0 1358
8
2
8
0 877
8
2
8
0 48
8
2
8
0 1527
8
2
8
0 952
8...

result:

ok 

Test #66:

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

input:

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

output:

8
0 1768
8
2
8
0 720
8
2
8
0 1262
8
2
8
0 681
8
2
8
0 821
8
2
8
0 1912
8
2
8
0 1151
8
2
8
0 450
8
2
8
0 1659
8
2
8
0 1095
8
2
8
0 943
8
2
8
0 1832
8
2
8
0 1491
8
2
8
0 921
8
2
8
0 1195
8
2
8
0 1280
8
2
8
0 1007
8
2
8
0 476
8
2
8
0 722
8
2
8
1 722
8
0 1247
8
2
8
0 1513
8
2
8
0 173
8
2
8
0 1526
8
2
8
...

result:

ok 

Test #67:

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

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

output:

8
0 429
8
2
8
0 1649
8
2
8
0 655
8
2
8
0 1768
8
2
8
0 222
8
2
8
0 509
8
2
8
0 1063
8
2
8
0 1346
8
2
8
0 1753
8
2
8
0 952
8
2
8
0 979
8
2
8
0 783
8
2
8
0 812
8
2
8
0 581
8
2
8
0 1045
8
2
8
0 1367
8
2
8
0 1770
8
2
8
0 1017
8
2
8
0 141
8
2
8
0 870
8
2
8
0 13
8
2
8
0 739
8
2
8
0 469
8
2
8
0 351
8
2
8
0 ...

result:

ok 

Test #68:

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

input:

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

output:

8
0 429
8
2
8
0 1649
8
2
8
0 655
8
2
8
0 1768
8
2
8
0 222
8
2
8
0 509
8
2
8
0 1063
8
2
8
0 1346
8
2
8
0 1753
8
2
8
0 952
8
2
8
0 979
8
2
8
0 783
8
2
8
1 783
8
0 812
8
2
8
1 812
8
0 581
8
2
8
0 1045
8
2
8
1 1045
8
0 1367
8
2
8
0 1770
8
2
8
0 1017
8
2
8
0 141
8
2
8
0 870
8
2
8
0 13
8
2
8
0 739
8
2
8
0...

result:

ok 

Test #69:

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

input:

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

output:

8
0 429
8
2
8
0 1649
8
2
8
0 655
8
2
8
0 1768
8
2
8
0 222
8
2
8
0 509
8
2
8
0 1063
8
2
8
0 1346
8
2
8
0 1753
8
2
8
0 952
8
2
8
0 979
8
2
8
0 783
8
2
8
1 783
8
0 812
8
2
8
1 812
8
0 581
8
2
8
0 1045
8
2
8
1 1045
8
0 1367
8
2
8
0 1770
8
2
8
0 1017
8
2
8
0 141
8
2
8
0 870
8
2
8
0 13
8
2
8
0 739
8
2
8
0...

result:

ok 

Test #70:

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

input:

1979
1
1
1
1
1
1
2
1
1
1
1
1
2
1
2
1
2
1
2
2
1
1
1
1
1
1
1
2
2
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
1
2
1
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 429
8
2
8
0 1649
8
2
8
0 655
8
2
8
0 1768
8
2
8
0 222
8
2
8
0 509
8
2
8
0 1063
8
2
8
1 1063
8
0 1346
8
2
8
0 1753
8
2
8
0 952
8
2
8
0 979
8
2
8
0 783
8
2
8
0 812
8
2
8
1 812
8
0 581
8
2
8
0 1045
8
2
8
1 1045
8
0 1367
8
2
8
0 1770
8
2
8
1 1770
8
0 1017
8
2
8
0 141
8
2
8
1 141
8
0 870
8
2
8
1 870
...

result:

ok 

Test #71:

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

input:

1979
1
1
1
1
1
1
2
1
1
1
1
1
2
1
2
1
2
1
2
2
2
1
1
1
1
1
1
2
2
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
1
2
1
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 429
8
2
8
0 1649
8
2
8
0 655
8
2
8
0 1768
8
2
8
0 222
8
2
8
0 509
8
2
8
0 1063
8
2
8
1 1063
8
0 1346
8
2
8
0 1753
8
2
8
0 952
8
2
8
0 979
8
2
8
0 783
8
2
8
0 812
8
2
8
1 812
8
0 581
8
2
8
0 1045
8
2
8
1 1045
8
0 1367
8
2
8
0 1770
8
2
8
1 1770
8
0 1017
8
2
8
0 141
8
2
8
1 141
8
0 870
8
2
8
1 870
...

result:

ok 

Test #72:

score: 71.29
Acceptable Answer
time: 26ms
memory: 3976kb

input:

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

output:

8
0 429
8
2
8
0 1649
8
2
8
0 655
8
2
8
0 1768
8
2
8
0 222
8
2
8
0 509
8
2
8
0 1063
8
2
8
0 1346
8
2
8
0 1753
8
2
8
0 952
8
2
8
0 979
8
2
8
0 783
8
2
8
1 783
8
0 812
8
2
8
1 812
8
0 581
8
2
8
0 1045
8
2
8
1 1045
8
0 1367
8
2
8
0 1770
8
2
8
0 1017
8
2
8
0 141
8
2
8
0 870
8
2
8
0 13
8
2
8
0 739
8
2
8
0...

result:

points 0.95053333330 points  0.95053333330

Test #73:

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

input:

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

output:

8
0 147
8
2
8
0 1978
8
2
8
0 1460
8
2
8
0 250
8
2
8
0 1041
8
2
8
0 108
8
2
8
0 1408
8
2
8
0 487
8
2
8
0 62
8
2
8
0 1792
8
2
8
0 1053
8
2
8
0 1150
8
2
8
0 1631
8
2
8
1 1631
8
0 1734
8
2
8
0 1180
8
2
8
0 923
8
2
8
0 344
8
2
8
0 1649
8
2
8
0 913
8
2
8
0 1043
8
2
8
1 1043
8
0 266
8
2
8
0 611
8
2
8
1 611...

result:

points 0.94773333330 points  0.94773333330

Test #74:

score: 68.16
Acceptable Answer
time: 24ms
memory: 4248kb

input:

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

output:

8
0 147
8
2
8
0 1978
8
2
8
0 1460
8
2
8
0 250
8
2
8
0 1041
8
2
8
0 108
8
2
8
0 1408
8
2
8
0 487
8
2
8
0 62
8
2
8
0 1792
8
2
8
0 1053
8
2
8
0 1150
8
2
8
0 1631
8
2
8
0 1734
8
2
8
0 1180
8
2
8
0 923
8
2
8
0 344
8
2
8
0 1649
8
2
8
0 913
8
2
8
0 1043
8
2
8
0 266
8
2
8
0 611
8
2
8
1 611
8
0 733
8
2
8
0 2...

result:

points 0.90880 points  0.90880

Test #75:

score: 67.45
Acceptable Answer
time: 11ms
memory: 3908kb

input:

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

output:

8
0 147
8
2
8
0 1978
8
2
8
0 1460
8
2
8
0 250
8
2
8
0 1041
8
2
8
0 108
8
2
8
0 1408
8
2
8
0 487
8
2
8
0 62
8
2
8
0 1792
8
2
8
0 1053
8
2
8
0 1150
8
2
8
0 1631
8
2
8
0 1734
8
2
8
0 1180
8
2
8
0 923
8
2
8
0 344
8
2
8
0 1649
8
2
8
0 913
8
2
8
0 1043
8
2
8
0 266
8
2
8
0 611
8
2
8
1 611
8
0 733
8
2
8
0 2...

result:

points 0.89933333330 points  0.89933333330

Test #76:

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

input:

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

output:

8
0 1073
8
2
8
0 1664
8
2
8
0 921
8
2
8
0 221
8
2
8
0 1040
8
2
8
0 475
8
2
8
0 1065
8
2
8
0 1911
8
2
8
0 299
8
2
8
1 299
8
0 123
8
2
8
1 123
8
0 1052
8
2
8
0 353
8
2
8
1 353
8
0 1630
8
2
8
0 485
8
2
8
0 1949
8
2
8
1 1949
8
0 922
8
2
8
0 1597
8
2
8
0 1648
8
2
8
0 912
8
2
8
0 1042
8
2
8
0 220
8
2
8
0 ...

result:

ok 

Test #77:

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

input:

1970
1
1
1
1
1
1
1
2
1
1
1
2
2
1
2
1
1
2
1
2
1
2
1
2
1
1
1
2
2
1
1
1
2
1
1
1
2
2
2
1
1
2
2
1
1
1
2
1
2
2
1
2
1
1
2
1
2
2
2
2
2
1
1
1
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
1
2
1
2
2
2
1
2
2
2
2
1
1
1
2
1
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
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 1879
8
2
8
0 675
8
2
8
0 874
8
2
8
0 2
8
2
8
0 1454
8
2
8
0 1646
8
2
8
0 63
8
2
8
0 1413
8
2
8
1 1413
8
0 1541
8
2
8
0 1122
8
2
8
0 1422
8
2
8
0 1772
8
2
8
1 1772
8
0 1497
8
2
8
1 1497
8
0 674
8
2
8
0 977
8
2
8
1 977
8
0 1771
8
2
8
0 667
8
2
8
0 78
8
2
8
1 78
8
0 1256
8
2
8
0 1952
8
2
8
1 1952
8...

result:

ok 

Test #78:

score: 71.43
Acceptable Answer
time: 4ms
memory: 4196kb

input:

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

output:

8
0 1879
8
2
8
0 675
8
2
8
0 874
8
2
8
0 2
8
2
8
0 1454
8
2
8
0 1646
8
2
8
0 63
8
2
8
0 1413
8
2
8
0 1541
8
2
8
0 1122
8
2
8
0 1422
8
2
8
0 1772
8
2
8
0 1497
8
2
8
0 674
8
2
8
0 977
8
2
8
0 1771
8
2
8
1 1771
8
0 667
8
2
8
0 78
8
2
8
0 1256
8
2
8
0 1952
8
2
8
0 1084
8
2
8
1 1084
8
0 518
8
2
8
0 1914
...

result:

points 0.95240 points  0.95240

Test #79:

score: 72.73
Acceptable Answer
time: 8ms
memory: 4228kb

input:

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

output:

8
0 1879
8
2
8
0 675
8
2
8
0 874
8
2
8
0 2
8
2
8
0 1454
8
2
8
0 1646
8
2
8
0 63
8
2
8
0 1413
8
2
8
0 1541
8
2
8
0 1122
8
2
8
0 1422
8
2
8
0 1772
8
2
8
1 1772
8
0 1497
8
2
8
0 674
8
2
8
0 977
8
2
8
0 1771
8
2
8
1 1771
8
0 667
8
2
8
0 78
8
2
8
0 1256
8
2
8
0 1952
8
2
8
0 1084
8
2
8
1 1084
8
0 518
8
2
...

result:

points 0.96973333330 points  0.96973333330

Test #80:

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

input:

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

output:

8
0 1879
8
2
8
0 675
8
2
8
0 874
8
2
8
0 2
8
2
8
0 1454
8
2
8
0 1646
8
2
8
0 63
8
2
8
0 1413
8
2
8
0 1541
8
2
8
0 1122
8
2
8
0 1422
8
2
8
0 1772
8
2
8
0 1497
8
2
8
0 674
8
2
8
0 977
8
2
8
0 1771
8
2
8
0 667
8
2
8
0 78
8
2
8
0 1256
8
2
8
0 1952
8
2
8
0 1084
8
2
8
0 518
8
2
8
1 518
8
0 1914
8
2
8
0 79...

result:

ok 

Test #81:

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

input:

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

output:

8
0 1879
8
2
8
0 675
8
2
8
0 874
8
2
8
0 2
8
2
8
0 1454
8
2
8
0 1646
8
2
8
0 63
8
2
8
0 1413
8
2
8
0 1541
8
2
8
0 1122
8
2
8
0 1422
8
2
8
0 1772
8
2
8
0 1497
8
2
8
0 674
8
2
8
0 977
8
2
8
0 1771
8
2
8
0 667
8
2
8
0 78
8
2
8
0 1256
8
2
8
0 1952
8
2
8
0 1084
8
2
8
0 518
8
2
8
1 518
8
0 1914
8
2
8
0 79...

result:

ok 

Test #82:

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

input:

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

output:

8
0 298
8
2
8
0 1838
8
2
8
0 1946
8
2
8
0 1816
8
2
8
0 1879
8
2
8
0 628
8
2
8
0 1932
8
2
8
0 489
8
2
8
0 1766
8
2
8
0 667
8
2
8
0 1026
8
2
8
0 457
8
2
8
0 971
8
2
8
1 971
8
0 1839
8
2
8
0 1811
8
2
8
0 1524
8
2
8
0 1512
8
2
8
1 1512
8
0 901
8
2
8
0 1362
8
2
8
0 362
8
2
8
0 1560
8
2
8
0 838
8
2
8
0 10...

result:

ok 

Test #83:

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

input:

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

output:

8
0 298
8
2
8
0 1838
8
2
8
0 1946
8
2
8
0 1816
8
2
8
0 1879
8
2
8
0 628
8
2
8
0 1932
8
2
8
1 1932
8
0 489
8
2
8
0 1766
8
2
8
0 667
8
2
8
0 1026
8
2
8
1 1026
8
0 457
8
2
8
0 971
8
2
8
0 1839
8
2
8
0 1811
8
2
8
0 1524
8
2
8
0 1512
8
2
8
0 901
8
2
8
0 1362
8
2
8
0 362
8
2
8
0 1560
8
2
8
0 838
8
2
8
1 8...

result:

ok 

Test #84:

score: 64.63
Acceptable Answer
time: 18ms
memory: 3808kb

input:

540
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 298
8
2
8
0 500
8
2
8
0 160
8
2
8
1 160
8
0 152
8
2
8
1 152
8
0 201
8
2
8
1 201
8
0 414
8
2
8
1 414
8
0 126
8
2
8
0 489
8
2
8
1 489
8
0 7
8
2
8
1 7
8
0 89
8
2
8
1 89
8
0 251
8
2
8
0 457
8
2
8
1 457
8
0 373
8
2
8
1 373
8
0 0
8
2
8
1 0
8
0 402
8
2
8
1 402
8
0 359
8
2
8
1 359
8
0 109
8
2
8
1 109
8
...

result:

points 0.86173333330 points  0.86173333330

Test #85:

score: 57.15
Acceptable Answer
time: 21ms
memory: 3964kb

input:

1834
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
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 298
8
2
8
0 1775
8
2
8
1 1775
8
0 1523
8
2
8
0 1816
8
2
8
1 1816
8
0 686
8
2
8
1 686
8
0 628
8
2
8
1 628
8
0 1487
8
2
8
1 1487
8
0 489
8
2
8
1 489
8
0 1766
8
2
8
1 1766
8
0 667
8
2
8
1 667
8
0 1026
8
2
8
1 1026
8
0 457
8
2
8
1 457
8
0 971
8
2
8
1 971
8
0 0
8
2
8
1 0
8
0 1811
8
2
8
1 1811
8
0 152...

result:

points 0.7620 points  0.7620

Test #86:

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

input:

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

output:

8
0 298
8
2
8
0 1838
8
2
8
1 1838
8
0 1946
8
2
8
1 1946
8
0 1816
8
2
8
1 1816
8
0 1879
8
2
8
1 1879
8
0 628
8
2
8
0 1932
8
2
8
1 1932
8
0 489
8
2
8
1 489
8
0 1766
8
2
8
1 1766
8
0 667
8
2
8
1 667
8
0 1026
8
2
8
1 1026
8
0 457
8
2
8
1 457
8
0 971
8
2
8
1 971
8
0 1839
8
2
8
1 1839
8
0 1811
8
2
8
1 181...

result:

ok 

Test #87:

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

input:

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

output:

8
0 1995
8
2
8
0 570
8
2
8
0 1851
8
2
8
0 1861
8
2
8
0 1065
8
2
8
0 293
8
2
8
1 293
8
0 262
8
2
8
1 262
8
0 1387
8
2
8
0 1671
8
2
8
0 553
8
2
8
1 553
8
0 144
8
2
8
1 144
8
0 981
8
2
8
1 981
8
0 1045
8
2
8
0 1083
8
2
8
0 1601
8
2
8
0 1511
8
2
8
0 1120
8
2
8
0 1225
8
2
8
0 245
8
2
8
1 245
8
0 963
8
2
...

result:

ok 

Test #88:

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

input:

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

output:

8
0 1995
8
2
8
0 570
8
2
8
0 1851
8
2
8
1 1851
8
0 1861
8
2
8
1 1861
8
0 1065
8
2
8
1 1065
8
0 293
8
2
8
0 262
8
2
8
0 1387
8
2
8
1 1387
8
0 1671
8
2
8
1 1671
8
0 553
8
2
8
0 144
8
2
8
0 981
8
2
8
0 1045
8
2
8
1 1045
8
0 1083
8
2
8
1 1083
8
0 1601
8
2
8
1 1601
8
0 1511
8
2
8
1 1511
8
0 1120
8
2
8
1 ...

result:

ok 

Test #89:

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

input:

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

output:

8
0 1995
8
2
8
0 570
8
2
8
0 1851
8
2
8
1 1851
8
0 1861
8
2
8
1 1861
8
0 1065
8
2
8
0 293
8
2
8
1 293
8
0 262
8
2
8
1 262
8
0 1387
8
2
8
0 1671
8
2
8
1 1671
8
0 553
8
2
8
0 144
8
2
8
1 144
8
0 981
8
2
8
0 1045
8
2
8
0 1083
8
2
8
0 1601
8
2
8
1 1601
8
0 1511
8
2
8
1 1511
8
0 1120
8
2
8
0 1225
8
2
8
0...

result:

ok