QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#430047#4565. Rarest Insectsjames1BadCreeper#47.51 44ms4212kbC++171.5kb2024-06-03 12:07:482024-06-03 12:07:50

Judging History

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

  • [2024-06-03 12:07:50]
  • 评测
  • 测评结果:47.51
  • 用时:44ms
  • 内存:4212kb
  • [2024-06-03 12:07:48]
  • 提交

answer

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

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

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

    while (L + 1 != R) {
        int mid = L + R >> 1; 
        if (check(mid)) L = mid; 
        else R = mid; 
    }
    return L; 
}

// 我们可以知道的信息:

// n 次代价知道昆虫种类数 k
// n 次代价知道最常见的昆虫基数

// 那么最罕见的昆虫的基数至多是 n / k
// 直接扫,

详细

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

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

output:

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

input:

2
1
2
2
2

output:

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

result:

ok 

Test #3:

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

input:

2
1
1

output:

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

result:

ok 

Test #4:

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

input:

3
1
2
1
2

output:

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

result:

ok 

Test #5:

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

input:

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

output:

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

result:

ok 

Test #6:

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

input:

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

output:

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

result:

ok 

Test #7:

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

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 22
8
2
8
0 40
8
2
8
1 40
8
0 168
8
2
8
1 168
8
0 42
8
2
8
1 42
8
0 13
8
2
8
1 13
8
0 106
8
2
8
1 106
8
0 46
8
2
8
1 46
8
0 193
8
2
8
1 193
8
0 102
8
2
8
1 102
8
0 198
8
2
8
1 198
8
0 117
8
2
8
1 117
8
0 27
8
2
8
1 27
8
0 180
8
2
8
1 180
8
0 189
8
2
8
1 189
8
0 192
8
2
8
1 192
8
0 71
8
2
8
1 71
8...

result:

ok 

Test #8:

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

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 59
8
2
8
0 21
8
2
8
0 115
8
2
8
0 4
8
2
8
0 12
8
2
8
0 41
8
2
8
0 8
8
2
8
0 192
8
2
8
0 47
8
2
8
0 146
8
2
8
0 116
8
2
8
0 10
8
2
8
0 132
8
2
8
0 188
8
2
8
0 122
8
2
8
0 178
8
2
8
0 126
8
2
8
0 80
8
2
8
0 91
8
2
8
0 101
8
2
8
0 149
8
2
8
0 25
8
2
8
0 30
8
2
8
0 44
8
2
8
0 76
8
2
8
0 147
8
2
8
0 ...

result:

ok 

Test #9:

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

input:

200
1
1
1
1
1
2
1
2
1
1
2
1
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
1
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 59
8
2
8
0 21
8
2
8
0 115
8
2
8
0 4
8
2
8
0 12
8
2
8
0 41
8
2
8
1 41
8
0 8
8
2
8
0 192
8
2
8
1 192
8
0 47
8
2
8
0 146
8
2
8
0 116
8
2
8
1 116
8
0 10
8
2
8
0 132
8
2
8
0 188
8
2
8
1 188
8
0 122
8
2
8
1 122
8
0 178
8
2
8
1 178
8
0 126
8
2
8
1 126
8
0 80
8
2
8
0 91
8
2
8
1 91
8
0 101
8
2
8
1 101
8
...

result:

ok 

Test #10:

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

input:

198
1
1
1
1
1
2
2
2
2
1
1
2
2
1
2
2
2
2
2
2
2
2
2
2
1
1
2
2
2
2
2
1
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 59
8
2
8
0 21
8
2
8
0 115
8
2
8
0 4
8
2
8
0 12
8
2
8
0 41
8
2
8
1 41
8
0 8
8
2
8
1 8
8
0 192
8
2
8
1 192
8
0 47
8
2
8
1 47
8
0 146
8
2
8
0 116
8
2
8
0 10
8
2
8
1 10
8
0 132
8
2
8
1 132
8
0 188
8
2
8
0 122
8
2
8
1 122
8
0 178
8
2
8
1 178
8
0 126
8
2
8
1 126
8
0 80
8
2
8
1 80
8
0 91
8
2
8
1 91
8
0...

result:

ok 

Test #11:

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

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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 22
8
2
8
0 40
8
2
8
1 40
8
0 168
8
2
8
1 168
8
0 42
8
2
8
1 42
8
0 13
8
2
8
1 13
8
0 106
8
2
8
1 106
8
0 46
8
2
8
1 46
8
0 193
8
2
8
1 193
8
0 102
8
2
8
1 102
8
0 198
8
2
8
1 198
8
0 117
8
2
8
1 117
8
0 27
8
2
8
1 27
8
0 180
8
2
8
1 180
8
0 189
8
2
8
1 189
8
0 192
8
2
8
1 192
8
0 71
8
2
8
1 71
8...

result:

ok 

Test #12:

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

input:

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

output:

8
0 22
8
2
8
0 40
8
2
8
0 168
8
2
8
0 42
8
2
8
0 13
8
2
8
0 106
8
2
8
0 46
8
2
8
0 193
8
2
8
0 102
8
2
8
1 102
8
0 147
8
2
8
1 147
8
0 117
8
2
8
0 27
8
2
8
1 27
8
0 180
8
2
8
1 180
8
0 189
8
2
8
0 192
8
2
8
1 192
8
0 71
8
2
8
0 179
8
2
8
1 179
8
0 140
8
2
8
0 81
8
2
8
1 81
8
0 65
8
2
8
1 65
8
0 49
8...

result:

ok 

Test #13:

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

input:

197
1
1
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 167
8
2
8
0 65
8
2
8
0 81
8
2
8
1 81
8
0 143
8
2
8
1 143
8
0 52
8
2
8
1 52
8
0 165
8
2
8
1 165
8
0 183
8
2
8
0 9
8
2
8
0 4
8
2
8
1 4
8
0 19
8
2
8
1 19
8
0 146
8
2
8
1 146
8
0 105
8
2
8
1 105
8
0 150
8
2
8
1 150
8
0 91
8
2
8
1 91
8
0 128
8
2
8
1 128
8
0 162
8
2
8
1 162
8
0 0
8
2
8
1 0
8
0 135
8
2...

result:

ok 

Test #14:

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

input:

198
1
1
1
1
1
1
2
2
1
2
2
2
1
1
1
2
2
2
2
2
2
2
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 166
8
2
8
0 119
8
2
8
0 80
8
2
8
0 142
8
2
8
0 11
8
2
8
0 164
8
2
8
0 182
8
2
8
1 182
8
0 4
8
2
8
1 4
8
0 61
8
2
8
0 45
8
2
8
1 45
8
0 60
8
2
8
1 60
8
0 104
8
2
8
1 104
8
0 149
8
2
8
0 97
8
2
8
0 105
8
2
8
0 10
8
2
8
1 10
8
0 102
8
2
8
1 102
8
0 134
8
2
8
1 134
8
0 100
8
2
8
1 100
8
0 172
8
2
8
...

result:

ok 

Test #15:

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

input:

200
1
2
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 166
8
2
8
0 119
8
2
8
1 119
8
0 80
8
2
8
1 80
8
0 142
8
2
8
0 11
8
2
8
1 11
8
0 164
8
2
8
0 182
8
2
8
0 4
8
2
8
1 4
8
0 61
8
2
8
1 61
8
0 45
8
2
8
1 45
8
0 60
8
2
8
1 60
8
0 104
8
2
8
1 104
8
0 149
8
2
8
1 149
8
0 97
8
2
8
0 105
8
2
8
1 105
8
0 10
8
2
8
1 10
8
0 102
8
2
8
1 102
8
0 134
8
2
8
1 1...

result:

ok 

Test #16:

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

input:

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

output:

8
0 166
8
2
8
0 119
8
2
8
0 80
8
2
8
0 142
8
2
8
0 11
8
2
8
1 11
8
0 164
8
2
8
0 182
8
2
8
1 182
8
0 4
8
2
8
1 4
8
0 61
8
2
8
0 45
8
2
8
0 60
8
2
8
1 60
8
0 104
8
2
8
1 104
8
0 149
8
2
8
1 149
8
0 97
8
2
8
1 97
8
0 105
8
2
8
1 105
8
0 10
8
2
8
1 10
8
0 102
8
2
8
1 102
8
0 134
8
2
8
1 134
8
0 100
8
2...

result:

ok 

Test #17:

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

input:

199
1
2
1
1
1
2
1
2
2
2
2
2
1
1
2
2
2
1
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 167
8
2
8
0 65
8
2
8
1 65
8
0 81
8
2
8
0 143
8
2
8
0 52
8
2
8
0 165
8
2
8
1 165
8
0 183
8
2
8
0 9
8
2
8
1 9
8
0 4
8
2
8
1 4
8
0 19
8
2
8
1 19
8
0 146
8
2
8
1 146
8
0 105
8
2
8
1 105
8
0 150
8
2
8
0 91
8
2
8
0 128
8
2
8
1 128
8
0 162
8
2
8
1 162
8
0 0
8
2
8
1 0
8
0 135
8
2
8
0 101
8
2
8
1 101
8
0...

result:

ok 

Test #18:

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

input:

196
1
1
1
1
2
2
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 166
8
2
8
0 119
8
2
8
0 80
8
2
8
0 142
8
2
8
0 11
8
2
8
1 11
8
0 164
8
2
8
1 164
8
0 182
8
2
8
0 4
8
2
8
0 61
8
2
8
0 45
8
2
8
1 45
8
0 60
8
2
8
1 60
8
0 104
8
2
8
1 104
8
0 149
8
2
8
0 97
8
2
8
0 105
8
2
8
1 105
8
0 10
8
2
8
1 10
8
0 102
8
2
8
1 102
8
0 134
8
2
8
1 134
8
0 100
8
2
8
1 100
8
0 1...

result:

ok 

Test #19:

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

input:

196
1
1
2
2
1
1
1
1
1
1
1
1
1
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 166
8
2
8
0 119
8
2
8
0 80
8
2
8
1 80
8
0 142
8
2
8
1 142
8
0 11
8
2
8
0 164
8
2
8
0 182
8
2
8
0 4
8
2
8
0 61
8
2
8
0 45
8
2
8
0 60
8
2
8
0 104
8
2
8
0 149
8
2
8
0 97
8
2
8
1 97
8
0 105
8
2
8
1 105
8
0 10
8
2
8
1 10
8
0 102
8
2
8
0 134
8
2
8
1 134
8
0 100
8
2
8
1 100
8
0 172
8
2
8
1 172
8
0 170
...

result:

ok 

Test #20:

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

input:

196
1
1
1
1
1
1
2
2
2
2
1
1
2
2
1
1
2
2
2
2
1
1
2
2
2
2
1
2
1
2
2
2
2
2
1
1
2
2
1
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 166
8
2
8
0 119
8
2
8
0 80
8
2
8
0 142
8
2
8
0 11
8
2
8
0 164
8
2
8
0 182
8
2
8
1 182
8
0 4
8
2
8
1 4
8
0 61
8
2
8
1 61
8
0 45
8
2
8
1 45
8
0 60
8
2
8
0 104
8
2
8
0 149
8
2
8
1 149
8
0 97
8
2
8
1 97
8
0 105
8
2
8
0 10
8
2
8
0 102
8
2
8
1 102
8
0 134
8
2
8
1 134
8
0 100
8
2
8
1 100
8
0 172
8
2
8
...

result:

ok 

Test #21:

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

input:

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

output:

8
0 166
8
2
8
0 119
8
2
8
0 80
8
2
8
0 142
8
2
8
0 11
8
2
8
0 164
8
2
8
0 182
8
2
8
0 4
8
2
8
0 61
8
2
8
0 45
8
2
8
1 45
8
0 60
8
2
8
0 104
8
2
8
0 149
8
2
8
1 149
8
0 97
8
2
8
0 105
8
2
8
0 10
8
2
8
0 102
8
2
8
0 134
8
2
8
0 100
8
2
8
1 100
8
0 172
8
2
8
0 170
8
2
8
0 140
8
2
8
0 74
8
2
8
0 101
8
2...

result:

ok 

Test #22:

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

input:

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

output:

8
0 167
8
2
8
0 65
8
2
8
0 81
8
2
8
0 143
8
2
8
0 52
8
2
8
0 165
8
2
8
0 183
8
2
8
0 9
8
2
8
0 4
8
2
8
0 19
8
2
8
0 146
8
2
8
0 105
8
2
8
0 150
8
2
8
0 91
8
2
8
0 128
8
2
8
0 162
8
2
8
1 162
8
0 0
8
2
8
0 135
8
2
8
1 135
8
0 101
8
2
8
0 173
8
2
8
0 171
8
2
8
0 141
8
2
8
0 86
8
2
8
1 86
8
0 75
8
2
8
...

result:

ok 

Test #23:

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

input:

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

output:

8
0 166
8
2
8
0 119
8
2
8
0 80
8
2
8
0 142
8
2
8
0 11
8
2
8
0 164
8
2
8
0 182
8
2
8
0 4
8
2
8
0 61
8
2
8
0 45
8
2
8
0 60
8
2
8
0 104
8
2
8
0 149
8
2
8
0 97
8
2
8
0 105
8
2
8
0 10
8
2
8
0 102
8
2
8
0 134
8
2
8
0 100
8
2
8
0 172
8
2
8
0 170
8
2
8
0 140
8
2
8
0 74
8
2
8
0 101
8
2
8
0 7
8
2
8
0 135
8
2
...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

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

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 166
8
2
8
0 663
8
2
8
1 663
8
0 650
8
2
8
1 650
8
0 731
8
2
8
1 731
8
0 538
8
2
8
1 538
8
0 422
8
2
8
1 422
8
0 594
8
2
8
1 594
8
0 924
8
2
8
1 924
8
0 379
8
2
8
1 379
8
0 45
8
2
8
1 45
8
0 665
8
2
8
1 665
8
0 909
8
2
8
1 909
8
0 149
8
2
8
1 149
8
0 97
8
2
8
1 97
8
0 849
8
2
8
1 849
8
0 732
8
2
...

result:

ok 

Test #25:

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

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 258
8
2
8
0 430
8
2
8
0 640
8
2
8
0 597
8
2
8
0 797
8
2
8
0 519
8
2
8
0 224
8
2
8
0 408
8
2
8
0 522
8
2
8
0 196
8
2
8
0 929
8
2
8
0 292
8
2
8
0 634
8
2
8
0 68
8
2
8
0 787
8
2
8
0 261
8
2
8
0 868
8
2
8
0 240
8
2
8
0 881
8
2
8
0 372
8
2
8
0 211
8
2
8
0 38
8
2
8
0 878
8
2
8
0 966
8
2
8
0 529
8
2
8
...

result:

ok 

Test #26:

score: 15
Accepted
time: 9ms
memory: 4204kb

input:

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

output:

8
0 390
8
2
8
0 431
8
2
8
0 874
8
2
8
0 479
8
2
8
0 7
8
2
8
0 536
8
2
8
0 590
8
2
8
1 590
8
0 409
8
2
8
0 523
8
2
8
1 523
8
0 309
8
2
8
1 309
8
0 265
8
2
8
0 293
8
2
8
1 293
8
0 635
8
2
8
1 635
8
0 72
8
2
8
0 271
8
2
8
0 44
8
2
8
0 869
8
2
8
0 241
8
2
8
0 926
8
2
8
0 756
8
2
8
0 88
8
2
8
0 87
8
2
8
...

result:

ok 

Test #27:

score: 15
Accepted
time: 26ms
memory: 4168kb

input:

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

output:

8
0 390
8
2
8
0 431
8
2
8
0 874
8
2
8
0 479
8
2
8
1 479
8
0 7
8
2
8
0 536
8
2
8
0 590
8
2
8
1 590
8
0 409
8
2
8
0 523
8
2
8
0 309
8
2
8
0 265
8
2
8
0 293
8
2
8
0 635
8
2
8
0 72
8
2
8
0 271
8
2
8
1 271
8
0 44
8
2
8
0 869
8
2
8
0 241
8
2
8
0 926
8
2
8
0 756
8
2
8
1 756
8
0 88
8
2
8
1 88
8
0 87
8
2
8
0...

result:

ok 

Test #28:

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

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 258
8
2
8
0 430
8
2
8
1 430
8
0 640
8
2
8
1 640
8
0 597
8
2
8
1 597
8
0 797
8
2
8
1 797
8
0 519
8
2
8
1 519
8
0 224
8
2
8
1 224
8
0 408
8
2
8
1 408
8
0 522
8
2
8
1 522
8
0 196
8
2
8
1 196
8
0 929
8
2
8
1 929
8
0 292
8
2
8
1 292
8
0 634
8
2
8
1 634
8
0 68
8
2
8
1 68
8
0 787
8
2
8
1 787
8
0 261
8
...

result:

ok 

Test #29:

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

input:

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

output:

8
0 204
8
2
8
0 724
8
2
8
0 208
8
2
8
0 779
8
2
8
1 779
8
0 539
8
2
8
0 354
8
2
8
0 93
8
2
8
0 627
8
2
8
1 627
8
0 390
8
2
8
0 558
8
2
8
1 558
8
0 958
8
2
8
0 785
8
2
8
0 385
8
2
8
1 385
8
0 859
8
2
8
1 859
8
0 424
8
2
8
1 424
8
0 87
8
2
8
1 87
8
0 782
8
2
8
0 389
8
2
8
1 389
8
0 711
8
2
8
1 711
8
0...

result:

ok 

Test #30:

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

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 243
8
2
8
0 611
8
2
8
0 247
8
2
8
0 778
8
2
8
1 778
8
0 883
8
2
8
1 883
8
0 182
8
2
8
0 111
8
2
8
1 111
8
0 773
8
2
8
1 773
8
0 709
8
2
8
1 709
8
0 464
8
2
8
1 464
8
0 705
8
2
8
1 705
8
0 784
8
2
8
1 784
8
0 809
8
2
8
1 809
8
0 858
8
2
8
1 858
8
0 374
8
2
8
1 374
8
0 303
8
2
8
1 303
8
0 531
8
2
...

result:

ok 

Test #31:

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

input:

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

output:

8
0 243
8
2
8
0 611
8
2
8
1 611
8
0 247
8
2
8
0 778
8
2
8
0 883
8
2
8
0 182
8
2
8
0 111
8
2
8
0 773
8
2
8
0 709
8
2
8
0 464
8
2
8
0 705
8
2
8
0 784
8
2
8
0 809
8
2
8
0 858
8
2
8
0 374
8
2
8
0 303
8
2
8
0 531
8
2
8
0 112
8
2
8
1 112
8
0 710
8
2
8
1 710
8
0 306
8
2
8
1 306
8
0 276
8
2
8
1 276
8
0 231
...

result:

ok 

Test #32:

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

input:

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

output:

8
0 243
8
2
8
0 611
8
2
8
0 247
8
2
8
1 247
8
0 778
8
2
8
0 883
8
2
8
0 182
8
2
8
0 111
8
2
8
1 111
8
0 773
8
2
8
1 773
8
0 709
8
2
8
1 709
8
0 464
8
2
8
1 464
8
0 705
8
2
8
1 705
8
0 784
8
2
8
1 784
8
0 809
8
2
8
1 809
8
0 858
8
2
8
1 858
8
0 374
8
2
8
1 374
8
0 303
8
2
8
1 303
8
0 531
8
2
8
1 531
...

result:

ok 

Test #33:

score: 15
Accepted
time: 22ms
memory: 3896kb

input:

996
1
1
1
2
1
2
2
1
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 225
8
2
8
0 341
8
2
8
0 201
8
2
8
0 897
8
2
8
1 897
8
0 52
8
2
8
0 182
8
2
8
1 182
8
0 753
8
2
8
1 753
8
0 427
8
2
8
0 912
8
2
8
0 617
8
2
8
1 617
8
0 410
8
2
8
1 410
8
0 598
8
2
8
1 598
8
0 746
8
2
8
1 746
8
0 631
8
2
8
1 631
8
0 362
8
2
8
1 362
8
0 672
8
2
8
1 672
8
0 390
8
2
8
1 390
8
0 489
8...

result:

ok 

Test #34:

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

input:

1000
1
1
2
1
1
1
2
2
2
2
1
1
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 225
8
2
8
0 341
8
2
8
0 201
8
2
8
1 201
8
0 897
8
2
8
0 52
8
2
8
0 182
8
2
8
0 753
8
2
8
1 753
8
0 427
8
2
8
1 427
8
0 912
8
2
8
1 912
8
0 617
8
2
8
1 617
8
0 410
8
2
8
0 598
8
2
8
0 746
8
2
8
0 631
8
2
8
1 631
8
0 362
8
2
8
1 362
8
0 672
8
2
8
1 672
8
0 390
8
2
8
1 390
8
0 489
8
2
8
1 489
8
0 9...

result:

ok 

Test #35:

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

input:

1000
1
1
2
1
1
2
1
2
1
2
1
1
2
2
1
2
2
2
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 225
8
2
8
0 341
8
2
8
0 201
8
2
8
1 201
8
0 897
8
2
8
0 52
8
2
8
0 182
8
2
8
1 182
8
0 753
8
2
8
0 427
8
2
8
1 427
8
0 912
8
2
8
0 617
8
2
8
1 617
8
0 410
8
2
8
0 598
8
2
8
0 746
8
2
8
1 746
8
0 631
8
2
8
1 631
8
0 362
8
2
8
0 672
8
2
8
1 672
8
0 390
8
2
8
1 390
8
0 489
8
2
8
1 489
8
0 932
8
2
8...

result:

ok 

Test #36:

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

input:

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

output:

8
0 124
8
2
8
0 198
8
2
8
0 225
8
2
8
0 467
8
2
8
0 310
8
2
8
0 906
8
2
8
0 497
8
2
8
0 894
8
2
8
1 894
8
0 860
8
2
8
1 860
8
0 791
8
2
8
1 791
8
0 520
8
2
8
1 520
8
0 673
8
2
8
0 812
8
2
8
1 812
8
0 367
8
2
8
0 94
8
2
8
0 179
8
2
8
0 195
8
2
8
0 746
8
2
8
1 746
8
0 22
8
2
8
1 22
8
0 642
8
2
8
0 490...

result:

ok 

Test #37:

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

input:

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

output:

8
0 124
8
2
8
0 198
8
2
8
1 198
8
0 225
8
2
8
0 467
8
2
8
0 310
8
2
8
0 906
8
2
8
1 906
8
0 497
8
2
8
0 894
8
2
8
0 860
8
2
8
0 791
8
2
8
1 791
8
0 520
8
2
8
0 673
8
2
8
0 812
8
2
8
0 367
8
2
8
1 367
8
0 94
8
2
8
0 179
8
2
8
0 195
8
2
8
1 195
8
0 746
8
2
8
1 746
8
0 22
8
2
8
0 642
8
2
8
1 642
8
0 49...

result:

ok 

Test #38:

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

input:

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

output:

8
0 124
8
2
8
0 198
8
2
8
0 225
8
2
8
0 467
8
2
8
0 310
8
2
8
0 906
8
2
8
0 497
8
2
8
0 894
8
2
8
0 860
8
2
8
0 791
8
2
8
0 520
8
2
8
0 673
8
2
8
0 812
8
2
8
1 812
8
0 367
8
2
8
0 94
8
2
8
0 179
8
2
8
0 195
8
2
8
0 746
8
2
8
1 746
8
0 22
8
2
8
0 642
8
2
8
1 642
8
0 490
8
2
8
0 848
8
2
8
1 848
8
0 35...

result:

ok 

Test #39:

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

input:

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

output:

8
0 220
8
2
8
0 217
8
2
8
0 701
8
2
8
0 197
8
2
8
0 970
8
2
8
0 202
8
2
8
0 326
8
2
8
0 899
8
2
8
0 136
8
2
8
0 398
8
2
8
0 862
8
2
8
0 836
8
2
8
0 777
8
2
8
1 777
8
0 66
8
2
8
0 942
8
2
8
0 400
8
2
8
0 260
8
2
8
1 260
8
0 210
8
2
8
0 252
8
2
8
0 911
8
2
8
0 570
8
2
8
0 704
8
2
8
0 433
8
2
8
0 642
8...

result:

ok 

Test #40:

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

input:

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

output:

8
0 341
8
2
8
0 503
8
2
8
0 700
8
2
8
0 196
8
2
8
0 890
8
2
8
0 821
8
2
8
0 945
8
2
8
0 898
8
2
8
0 529
8
2
8
0 37
8
2
8
0 427
8
2
8
0 283
8
2
8
0 779
8
2
8
0 267
8
2
8
0 651
8
2
8
1 651
8
0 65
8
2
8
0 236
8
2
8
0 329
8
2
8
1 329
8
0 929
8
2
8
0 910
8
2
8
0 413
8
2
8
0 26
8
2
8
0 432
8
2
8
0 955
8
2...

result:

ok 

Test #41:

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

input:

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

output:

8
0 220
8
2
8
0 217
8
2
8
0 701
8
2
8
0 197
8
2
8
0 970
8
2
8
0 202
8
2
8
0 326
8
2
8
0 899
8
2
8
0 136
8
2
8
0 398
8
2
8
0 862
8
2
8
0 836
8
2
8
0 777
8
2
8
0 66
8
2
8
0 942
8
2
8
0 400
8
2
8
0 260
8
2
8
0 210
8
2
8
0 252
8
2
8
0 911
8
2
8
0 570
8
2
8
1 570
8
0 704
8
2
8
0 433
8
2
8
0 642
8
2
8
0 2...

result:

ok 

Test #42:

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

input:

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

output:

8
0 220
8
2
8
0 217
8
2
8
0 701
8
2
8
0 197
8
2
8
0 970
8
2
8
0 202
8
2
8
0 326
8
2
8
0 899
8
2
8
0 136
8
2
8
0 398
8
2
8
0 862
8
2
8
0 836
8
2
8
0 777
8
2
8
0 66
8
2
8
0 942
8
2
8
0 400
8
2
8
0 260
8
2
8
0 210
8
2
8
0 252
8
2
8
0 911
8
2
8
0 570
8
2
8
0 704
8
2
8
0 433
8
2
8
0 642
8
2
8
0 204
8
2
8...

result:

ok 

Subtask #3:

score: 22.51
Acceptable Answer

Test #43:

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

input:

2
1
2
2
2

output:

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

result:

ok 

Test #44:

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

input:

2
1
1

output:

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

result:

ok 

Test #45:

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

input:

3
1
1
2
2

output:

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

result:

ok 

Test #46:

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

input:

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

output:

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

result:

ok 

Test #47:

score: 73.74
Acceptable Answer
time: 1ms
memory: 3900kb

input:

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

output:

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

result:

points 0.98320 points  0.98320

Test #48:

score: 22.51
Acceptable Answer
time: 25ms
memory: 3860kb

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 341
8
2
8
0 1368
8
2
8
1 1368
8
0 1340
8
2
8
1 1340
8
0 196
8
2
8
1 196
8
0 890
8
2
8
1 890
8
0 1221
8
2
8
1 1221
8
0 1358
8
2
8
1 1358
8
0 1182
8
2
8
1 1182
8
0 529
8
2
8
1 529
8
0 37
8
2
8
1 37
8
0 427
8
2
8
1 427
8
0 283
8
2
8
1 283
8
0 1889
8
2
8
1 1889
8
0 267
8
2
8
1 267
8
0 651
8
2
8
1 65...

result:

points 0.30013333330 points  0.30013333330

Test #49:

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

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 545
8
2
8
0 518
8
2
8
0 776
8
2
8
0 395
8
2
8
0 1226
8
2
8
0 327
8
2
8
0 38
8
2
8
0 204
8
2
8
0 1164
8
2
8
0 1410
8
2
8
0 1431
8
2
8
0 1289
8
2
8
0 630
8
2
8
0 1749
8
2
8
0 1730
8
2
8
0 147
8
2
8
0 1132
8
2
8
0 1184
8
2
8
0 1597
8
2
8
0 1124
8
2
8
0 466
8
2
8
0 846
8
2
8
0 902
8
2
8
0 855
8
2
8
...

result:

ok 

Test #50:

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

input:

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

output:

8
0 545
8
2
8
0 518
8
2
8
0 776
8
2
8
0 395
8
2
8
0 1226
8
2
8
0 327
8
2
8
0 38
8
2
8
0 204
8
2
8
0 1164
8
2
8
0 1410
8
2
8
0 1431
8
2
8
0 1289
8
2
8
1 1289
8
0 630
8
2
8
0 1749
8
2
8
0 1730
8
2
8
0 147
8
2
8
0 1132
8
2
8
0 1184
8
2
8
1 1184
8
0 1597
8
2
8
0 1124
8
2
8
0 466
8
2
8
0 846
8
2
8
1 846
...

result:

points 0.61626666670 points  0.61626666670

Test #51:

score: 58.23
Acceptable Answer
time: 12ms
memory: 3916kb

input:

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

output:

8
0 694
8
2
8
0 35
8
2
8
0 1030
8
2
8
0 80
8
2
8
0 985
8
2
8
0 697
8
2
8
0 1124
8
2
8
0 1689
8
2
8
0 66
8
2
8
0 266
8
2
8
0 1446
8
2
8
1 1446
8
0 1496
8
2
8
0 802
8
2
8
0 700
8
2
8
0 1135
8
2
8
1 1135
8
0 1781
8
2
8
0 15
8
2
8
0 672
8
2
8
0 425
8
2
8
0 1543
8
2
8
0 1471
8
2
8
1 1471
8
0 1194
8
2
8
1...

result:

points 0.77640 points  0.77640

Test #52:

score: 26.47
Acceptable Answer
time: 44ms
memory: 3840kb

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 694
8
2
8
0 35
8
2
8
1 35
8
0 1030
8
2
8
1 1030
8
0 80
8
2
8
1 80
8
0 985
8
2
8
1 985
8
0 697
8
2
8
1 697
8
0 1124
8
2
8
1 1124
8
0 1689
8
2
8
1 1689
8
0 66
8
2
8
1 66
8
0 266
8
2
8
1 266
8
0 1446
8
2
8
1 1446
8
0 1496
8
2
8
1 1496
8
0 802
8
2
8
1 802
8
0 700
8
2
8
1 700
8
0 1135
8
2
8
1 1135
8
...

result:

points 0.35293333330 points  0.35293333330

Test #53:

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

input:

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

output:

8
0 471
8
2
8
0 1306
8
2
8
0 6
8
2
8
0 373
8
2
8
1 373
8
0 1325
8
2
8
0 1397
8
2
8
0 1932
8
2
8
1 1932
8
0 651
8
2
8
0 965
8
2
8
0 1972
8
2
8
0 247
8
2
8
1 247
8
0 1193
8
2
8
1 1193
8
0 202
8
2
8
1 202
8
0 1577
8
2
8
1 1577
8
0 501
8
2
8
0 5
8
2
8
0 1262
8
2
8
1 1262
8
0 1578
8
2
8
0 1382
8
2
8
1 13...

result:

ok 

Test #54:

score: 28.89
Acceptable Answer
time: 23ms
memory: 3912kb

input:

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

output:

8
0 471
8
2
8
0 1306
8
2
8
0 6
8
2
8
0 373
8
2
8
1 373
8
0 1325
8
2
8
1 1325
8
0 1397
8
2
8
1 1397
8
0 1932
8
2
8
1 1932
8
0 651
8
2
8
1 651
8
0 965
8
2
8
1 965
8
0 1972
8
2
8
1 1972
8
0 247
8
2
8
1 247
8
0 1193
8
2
8
1 1193
8
0 202
8
2
8
1 202
8
0 1577
8
2
8
0 501
8
2
8
1 501
8
0 5
8
2
8
1 5
8
0 12...

result:

points 0.38520 points  0.38520

Test #55:

score: 58
Acceptable Answer
time: 20ms
memory: 4204kb

input:

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

output:

8
0 1871
8
2
8
0 1148
8
2
8
0 365
8
2
8
0 311
8
2
8
0 1762
8
2
8
0 154
8
2
8
0 1263
8
2
8
0 846
8
2
8
1 846
8
0 12
8
2
8
1 12
8
0 393
8
2
8
0 1435
8
2
8
1 1435
8
0 1614
8
2
8
0 1520
8
2
8
0 663
8
2
8
1 663
8
0 1606
8
2
8
1 1606
8
0 1245
8
2
8
1 1245
8
0 1469
8
2
8
0 371
8
2
8
1 371
8
0 858
8
2
8
0 1...

result:

points 0.77333333330 points  0.77333333330

Test #56:

score: 32.28
Acceptable Answer
time: 17ms
memory: 3948kb

input:

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

output:

8
0 839
8
2
8
0 1377
8
2
8
0 314
8
2
8
1 314
8
0 680
8
2
8
0 578
8
2
8
0 1862
8
2
8
1 1862
8
0 638
8
2
8
1 638
8
0 976
8
2
8
1 976
8
0 185
8
2
8
0 982
8
2
8
1 982
8
0 630
8
2
8
1 630
8
0 1238
8
2
8
1 1238
8
0 1239
8
2
8
1 1239
8
0 164
8
2
8
1 164
8
0 1504
8
2
8
1 1504
8
0 321
8
2
8
1 321
8
0 178
8
2...

result:

points 0.43040 points  0.43040

Test #57:

score: 32.32
Acceptable Answer
time: 30ms
memory: 4212kb

input:

1999
1
1
1
1
2
1
1
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 618
8
2
8
0 973
8
2
8
0 802
8
2
8
0 482
8
2
8
0 490
8
2
8
1 490
8
0 470
8
2
8
0 402
8
2
8
0 186
8
2
8
1 186
8
0 425
8
2
8
1 425
8
0 736
8
2
8
1 736
8
0 82
8
2
8
0 1585
8
2
8
1 1585
8
0 1898
8
2
8
1 1898
8
0 1467
8
2
8
1 1467
8
0 1559
8
2
8
0 929
8
2
8
1 929
8
0 956
8
2
8
1 956
8
0 301
8
2
8
1 30...

result:

points 0.43093333330 points  0.43093333330

Test #58:

score: 32.36
Acceptable Answer
time: 35ms
memory: 3928kb

input:

1997
1
1
2
1
1
1
1
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 618
8
2
8
0 973
8
2
8
0 802
8
2
8
1 802
8
0 482
8
2
8
0 490
8
2
8
0 470
8
2
8
0 402
8
2
8
0 186
8
2
8
1 186
8
0 425
8
2
8
1 425
8
0 736
8
2
8
1 736
8
0 82
8
2
8
0 1585
8
2
8
1 1585
8
0 1898
8
2
8
0 1467
8
2
8
1 1467
8
0 1559
8
2
8
1 1559
8
0 929
8
2
8
1 929
8
0 956
8
2
8
1 956
8
0 301
8
2
8
1 30...

result:

points 0.43146666670 points  0.43146666670

Test #59:

score: 37.79
Acceptable Answer
time: 29ms
memory: 3972kb

input:

1998
1
1
2
1
2
1
1
1
1
1
2
2
2
2
2
2
2
1
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1968
8
2
8
0 779
8
2
8
0 1785
8
2
8
1 1785
8
0 499
8
2
8
0 59
8
2
8
1 59
8
0 1923
8
2
8
0 1326
8
2
8
0 1338
8
2
8
0 1144
8
2
8
0 1729
8
2
8
0 972
8
2
8
1 972
8
0 333
8
2
8
1 333
8
0 36
8
2
8
1 36
8
0 1154
8
2
8
1 1154
8
0 491
8
2
8
1 491
8
0 800
8
2
8
1 800
8
0 1019
8
2
8
1 1019
8
0 886
8
2
8
0 ...

result:

points 0.50386666670 points  0.50386666670

Test #60:

score: 32.42
Acceptable Answer
time: 41ms
memory: 3992kb

input:

1996
1
1
1
1
1
2
1
2
1
2
1
1
2
2
2
2
1
2
2
1
1
2
2
2
2
2
2
2
2
2
1
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 20
8
2
8
0 749
8
2
8
0 1420
8
2
8
0 1381
8
2
8
0 1318
8
2
8
0 1010
8
2
8
1 1010
8
0 940
8
2
8
0 1450
8
2
8
1 1450
8
0 1077
8
2
8
0 1229
8
2
8
1 1229
8
0 1415
8
2
8
0 224
8
2
8
0 1719
8
2
8
1 1719
8
0 825
8
2
8
1 825
8
0 563
8
2
8
1 563
8
0 1625
8
2
8
1 1625
8
0 1159
8
2
8
0 418
8
2
8
1 418
8
0 1...

result:

points 0.43226666670 points  0.43226666670

Test #61:

score: 37.97
Acceptable Answer
time: 15ms
memory: 3868kb

input:

2000
1
2
1
1
1
1
2
2
1
1
1
1
2
1
1
2
2
2
1
1
1
2
1
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1760
8
2
8
0 1107
8
2
8
1 1107
8
0 697
8
2
8
0 1563
8
2
8
0 1849
8
2
8
0 1038
8
2
8
0 1627
8
2
8
1 1627
8
0 987
8
2
8
1 987
8
0 765
8
2
8
0 210
8
2
8
0 429
8
2
8
0 1012
8
2
8
0 956
8
2
8
1 956
8
0 1087
8
2
8
0 352
8
2
8
0 1298
8
2
8
1 1298
8
0 1422
8
2
8
1 1422
8
0 1961
8
2
8
1 1961
8
0 574
8
2
...

result:

points 0.50626666670 points  0.50626666670

Test #62:

score: 58.04
Acceptable Answer
time: 36ms
memory: 3988kb

input:

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

output:

8
0 1760
8
2
8
0 1107
8
2
8
0 697
8
2
8
0 1563
8
2
8
0 1849
8
2
8
0 1038
8
2
8
1 1038
8
0 1627
8
2
8
0 987
8
2
8
0 765
8
2
8
0 210
8
2
8
1 210
8
0 429
8
2
8
0 1012
8
2
8
0 956
8
2
8
0 1087
8
2
8
1 1087
8
0 352
8
2
8
0 1298
8
2
8
1 1298
8
0 1422
8
2
8
1 1422
8
0 1961
8
2
8
0 574
8
2
8
0 1086
8
2
8
0 ...

result:

points 0.77386666670 points  0.77386666670

Test #63:

score: 65.68
Acceptable Answer
time: 10ms
memory: 4180kb

input:

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

output:

8
0 441
8
2
8
0 1890
8
2
8
0 1865
8
2
8
0 1360
8
2
8
0 193
8
2
8
0 346
8
2
8
1 346
8
0 1311
8
2
8
0 1251
8
2
8
0 1751
8
2
8
0 53
8
2
8
0 677
8
2
8
0 455
8
2
8
0 1922
8
2
8
0 635
8
2
8
0 1539
8
2
8
0 172
8
2
8
0 1678
8
2
8
0 1186
8
2
8
0 889
8
2
8
0 1673
8
2
8
0 1674
8
2
8
0 1127
8
2
8
0 126
8
2
8
0 ...

result:

points 0.87573333330 points  0.87573333330

Test #64:

score: 71.9
Acceptable Answer
time: 12ms
memory: 4204kb

input:

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

output:

8
0 182
8
2
8
0 1891
8
2
8
0 1219
8
2
8
0 1426
8
2
8
0 120
8
2
8
0 886
8
2
8
1 886
8
0 44
8
2
8
0 1033
8
2
8
0 1984
8
2
8
0 124
8
2
8
0 1462
8
2
8
0 163
8
2
8
0 1923
8
2
8
0 1842
8
2
8
0 1439
8
2
8
0 342
8
2
8
0 1679
8
2
8
0 1187
8
2
8
0 426
8
2
8
0 59
8
2
8
0 1675
8
2
8
0 1027
8
2
8
0 562
8
2
8
0 2...

result:

points 0.95866666670 points  0.95866666670

Test #65:

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

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

output:

8
0 53
8
2
8
0 1996
8
2
8
0 253
8
2
8
0 704
8
2
8
0 149
8
2
8
0 90
8
2
8
0 160
8
2
8
0 1231
8
2
8
0 1882
8
2
8
0 1965
8
2
8
0 1605
8
2
8
0 684
8
2
8
0 318
8
2
8
0 284
8
2
8
0 157
8
2
8
0 1796
8
2
8
0 1419
8
2
8
0 1701
8
2
8
0 869
8
2
8
0 1144
8
2
8
0 423
8
2
8
0 712
8
2
8
0 1280
8
2
8
0 1777
8
2
8
0...

result:

ok 

Test #66:

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

input:

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

output:

8
0 793
8
2
8
0 1866
8
2
8
0 563
8
2
8
0 1239
8
2
8
0 1003
8
2
8
0 1451
8
2
8
0 9
8
2
8
0 1809
8
2
8
0 1738
8
2
8
0 1966
8
2
8
0 1606
8
2
8
0 242
8
2
8
0 119
8
2
8
0 1249
8
2
8
0 629
8
2
8
0 1342
8
2
8
0 1563
8
2
8
0 1702
8
2
8
0 868
8
2
8
0 1595
8
2
8
0 422
8
2
8
0 1385
8
2
8
0 1179
8
2
8
0 1778
8
...

result:

ok 

Test #67:

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

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

output:

8
0 53
8
2
8
0 1996
8
2
8
0 253
8
2
8
0 704
8
2
8
0 149
8
2
8
0 90
8
2
8
0 160
8
2
8
0 1231
8
2
8
0 1882
8
2
8
0 1965
8
2
8
0 1605
8
2
8
0 684
8
2
8
0 318
8
2
8
0 284
8
2
8
0 157
8
2
8
0 1796
8
2
8
0 1419
8
2
8
0 1701
8
2
8
0 869
8
2
8
0 1144
8
2
8
0 423
8
2
8
0 712
8
2
8
0 1280
8
2
8
0 1777
8
2
8
0...

result:

ok 

Test #68:

score: 46.7
Acceptable Answer
time: 26ms
memory: 4200kb

input:

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

output:

8
0 53
8
2
8
0 1865
8
2
8
0 253
8
2
8
0 704
8
2
8
0 149
8
2
8
0 90
8
2
8
1 90
8
0 160
8
2
8
0 1231
8
2
8
0 1882
8
2
8
1 1882
8
0 1965
8
2
8
0 1605
8
2
8
0 684
8
2
8
0 318
8
2
8
0 284
8
2
8
0 157
8
2
8
0 1796
8
2
8
0 1419
8
2
8
0 1701
8
2
8
0 869
8
2
8
0 1144
8
2
8
1 1144
8
0 423
8
2
8
0 712
8
2
8
0 ...

result:

points 0.62266666670 points  0.62266666670

Test #69:

score: 46.7
Acceptable Answer
time: 36ms
memory: 4212kb

input:

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

output:

8
0 289
8
2
8
0 793
8
2
8
0 1975
8
2
8
0 25
8
2
8
0 1340
8
2
8
0 549
8
2
8
0 204
8
2
8
0 1060
8
2
8
0 1567
8
2
8
0 934
8
2
8
0 1054
8
2
8
0 703
8
2
8
0 1587
8
2
8
1 1587
8
0 676
8
2
8
1 676
8
0 1575
8
2
8
0 962
8
2
8
1 962
8
0 792
8
2
8
0 983
8
2
8
0 1250
8
2
8
0 918
8
2
8
1 918
8
0 352
8
2
8
1 352
...

result:

points 0.62266666670 points  0.62266666670

Test #70:

score: 38.18
Acceptable Answer
time: 10ms
memory: 3920kb

input:

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

output:

8
0 597
8
2
8
0 279
8
2
8
0 1496
8
2
8
1 1496
8
0 1337
8
2
8
0 1295
8
2
8
0 792
8
2
8
0 1235
8
2
8
1 1235
8
0 314
8
2
8
0 96
8
2
8
1 96
8
0 910
8
2
8
0 1812
8
2
8
0 799
8
2
8
0 943
8
2
8
0 1164
8
2
8
0 1476
8
2
8
0 239
8
2
8
0 1276
8
2
8
0 1688
8
2
8
0 1109
8
2
8
1 1109
8
0 1275
8
2
8
0 1170
8
2
8
0...

result:

points 0.50906666670 points  0.50906666670

Test #71:

score: 38.18
Acceptable Answer
time: 27ms
memory: 3912kb

input:

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

output:

8
0 597
8
2
8
0 279
8
2
8
0 1496
8
2
8
1 1496
8
0 1337
8
2
8
0 1295
8
2
8
0 792
8
2
8
0 1235
8
2
8
1 1235
8
0 314
8
2
8
0 96
8
2
8
1 96
8
0 910
8
2
8
0 1812
8
2
8
0 799
8
2
8
0 943
8
2
8
0 1164
8
2
8
0 1476
8
2
8
0 239
8
2
8
0 1276
8
2
8
0 1688
8
2
8
0 1109
8
2
8
1 1109
8
0 1275
8
2
8
0 1170
8
2
8
0...

result:

points 0.50906666670 points  0.50906666670

Test #72:

score: 58.24
Acceptable Answer
time: 27ms
memory: 3912kb

input:

1981
1
1
1
1
1
1
2
1
2
1
1
1
1
1
1
1
1
1
1
2
1
2
1
2
1
2
1
2
1
1
1
2
2
2
2
1
2
1
1
2
1
1
2
2
2
1
2
2
2
1
1
1
1
2
2
2
2
2
1
2
1
2
1
2
2
2
2
2
1
2
2
1
2
2
2
1
1
2
1
2
2
1
2
1
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
1
2
2
2
2
2
1
1
2
2
2
2
2
2
1
2
2
2
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
1...

output:

8
0 391
8
2
8
0 346
8
2
8
0 852
8
2
8
0 119
8
2
8
0 1345
8
2
8
0 80
8
2
8
0 509
8
2
8
1 509
8
0 1652
8
2
8
0 1319
8
2
8
1 1319
8
0 1347
8
2
8
0 1643
8
2
8
0 1774
8
2
8
0 457
8
2
8
0 1356
8
2
8
0 56
8
2
8
0 101
8
2
8
0 961
8
2
8
0 1565
8
2
8
0 1537
8
2
8
0 1821
8
2
8
1 1821
8
0 848
8
2
8
0 711
8
2
8
...

result:

points 0.77653333330 points  0.77653333330

Test #73:

score: 58.24
Acceptable Answer
time: 14ms
memory: 3988kb

input:

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

output:

8
0 1728
8
2
8
0 1087
8
2
8
0 1134
8
2
8
0 673
8
2
8
0 85
8
2
8
0 819
8
2
8
0 1014
8
2
8
0 1675
8
2
8
0 1342
8
2
8
0 117
8
2
8
0 1584
8
2
8
0 1177
8
2
8
0 1641
8
2
8
0 1067
8
2
8
0 1113
8
2
8
0 441
8
2
8
0 953
8
2
8
0 1757
8
2
8
1 1757
8
0 1795
8
2
8
0 925
8
2
8
1 925
8
0 1207
8
2
8
1 1207
8
0 784
8...

result:

points 0.77653333330 points  0.77653333330

Test #74:

score: 65.89
Acceptable Answer
time: 4ms
memory: 3920kb

input:

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

output:

8
0 1728
8
2
8
0 1087
8
2
8
0 1134
8
2
8
0 673
8
2
8
0 85
8
2
8
0 819
8
2
8
0 1014
8
2
8
0 1675
8
2
8
0 1342
8
2
8
0 117
8
2
8
0 1584
8
2
8
0 1177
8
2
8
0 1641
8
2
8
1 1641
8
0 1067
8
2
8
0 1113
8
2
8
0 441
8
2
8
1 441
8
0 953
8
2
8
0 1757
8
2
8
1 1757
8
0 1795
8
2
8
0 925
8
2
8
0 1207
8
2
8
0 784
8...

result:

points 0.87853333330 points  0.87853333330

Test #75:

score: 65.89
Acceptable Answer
time: 14ms
memory: 3924kb

input:

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

output:

8
0 1312
8
2
8
0 1157
8
2
8
0 51
8
2
8
0 460
8
2
8
0 625
8
2
8
0 81
8
2
8
0 1329
8
2
8
0 1813
8
2
8
0 1630
8
2
8
0 255
8
2
8
0 1584
8
2
8
0 1725
8
2
8
0 619
8
2
8
0 1751
8
2
8
0 1714
8
2
8
0 1432
8
2
8
0 1746
8
2
8
1 1746
8
0 911
8
2
8
0 366
8
2
8
0 692
8
2
8
1 692
8
0 1807
8
2
8
0 501
8
2
8
0 656
8...

result:

points 0.87853333330 points  0.87853333330

Test #76:

score: 46.65
Acceptable Answer
time: 18ms
memory: 3896kb

input:

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

output:

8
0 274
8
2
8
0 1156
8
2
8
0 1573
8
2
8
0 344
8
2
8
0 624
8
2
8
0 80
8
2
8
0 1328
8
2
8
0 1812
8
2
8
0 1382
8
2
8
0 957
8
2
8
1 957
8
0 1148
8
2
8
0 1724
8
2
8
1 1724
8
0 779
8
2
8
0 1750
8
2
8
0 961
8
2
8
0 27
8
2
8
0 1433
8
2
8
1 1433
8
0 1901
8
2
8
0 1733
8
2
8
1 1733
8
0 169
8
2
8
0 1806
8
2
8
0...

result:

points 0.6220 points  0.6220

Test #77:

score: 46.65
Acceptable Answer
time: 17ms
memory: 3968kb

input:

1970
1
1
1
1
1
1
2
1
1
1
1
2
1
1
1
1
1
2
1
1
1
1
1
1
2
1
2
1
1
1
2
1
1
2
1
2
2
1
2
1
2
2
1
1
1
1
2
2
1
2
1
1
1
1
2
2
1
1
2
2
2
1
1
2
2
2
2
2
1
2
2
1
2
2
2
1
2
2
2
2
2
1
2
2
2
1
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
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 1510
8
2
8
0 642
8
2
8
0 1410
8
2
8
0 1203
8
2
8
0 1841
8
2
8
0 1694
8
2
8
0 839
8
2
8
1 839
8
0 1575
8
2
8
0 701
8
2
8
0 484
8
2
8
0 528
8
2
8
0 1018
8
2
8
1 1018
8
0 464
8
2
8
0 330
8
2
8
0 164
8
2
8
0 444
8
2
8
0 168
8
2
8
0 134
8
2
8
1 134
8
0 979
8
2
8
0 1392
8
2
8
0 1331
8
2
8
0 96
8
2
8
0...

result:

points 0.6220 points  0.6220

Test #78:

score: 58.23
Acceptable Answer
time: 13ms
memory: 3920kb

input:

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

output:

8
0 1510
8
2
8
0 642
8
2
8
0 1410
8
2
8
0 1203
8
2
8
0 1841
8
2
8
0 1694
8
2
8
0 839
8
2
8
0 1575
8
2
8
0 701
8
2
8
1 701
8
0 484
8
2
8
1 484
8
0 528
8
2
8
0 1018
8
2
8
0 464
8
2
8
0 330
8
2
8
1 330
8
0 164
8
2
8
0 444
8
2
8
0 168
8
2
8
0 134
8
2
8
0 979
8
2
8
1 979
8
0 1392
8
2
8
1 1392
8
0 1331
8
...

result:

points 0.77640 points  0.77640

Test #79:

score: 58.23
Acceptable Answer
time: 9ms
memory: 4204kb

input:

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

output:

8
0 315
8
2
8
0 565
8
2
8
0 815
8
2
8
0 1164
8
2
8
0 696
8
2
8
0 633
8
2
8
1 633
8
0 123
8
2
8
0 1019
8
2
8
0 1193
8
2
8
0 1144
8
2
8
0 665
8
2
8
1 665
8
0 1506
8
2
8
0 1087
8
2
8
0 1491
8
2
8
1 1491
8
0 1790
8
2
8
1 1790
8
0 916
8
2
8
1 916
8
0 1420
8
2
8
0 483
8
2
8
0 865
8
2
8
0 266
8
2
8
0 1279
...

result:

points 0.77640 points  0.77640

Test #80:

score: 59.3
Acceptable Answer
time: 18ms
memory: 3992kb

input:

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

output:

8
0 315
8
2
8
0 565
8
2
8
0 815
8
2
8
0 1164
8
2
8
0 696
8
2
8
1 696
8
0 633
8
2
8
0 123
8
2
8
0 1019
8
2
8
0 1193
8
2
8
0 1144
8
2
8
0 665
8
2
8
0 1506
8
2
8
0 1087
8
2
8
0 1491
8
2
8
0 1790
8
2
8
0 916
8
2
8
1 916
8
0 1420
8
2
8
0 483
8
2
8
0 865
8
2
8
0 266
8
2
8
0 1279
8
2
8
0 183
8
2
8
0 1716
8...

result:

points 0.79066666670 points  0.79066666670

Test #81:

score: 59.3
Acceptable Answer
time: 19ms
memory: 3920kb

input:

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

output:

8
0 1628
8
2
8
0 26
8
2
8
0 1253
8
2
8
0 455
8
2
8
0 986
8
2
8
0 772
8
2
8
0 1473
8
2
8
0 951
8
2
8
0 807
8
2
8
0 994
8
2
8
0 1414
8
2
8
0 835
8
2
8
0 1161
8
2
8
0 1068
8
2
8
1 1068
8
0 65
8
2
8
0 1403
8
2
8
0 167
8
2
8
1 167
8
0 530
8
2
8
0 746
8
2
8
0 1520
8
2
8
1 1520
8
0 673
8
2
8
0 231
8
2
8
0 ...

result:

points 0.79066666670 points  0.79066666670

Test #82:

score: 46.65
Acceptable Answer
time: 29ms
memory: 3908kb

input:

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

output:

8
0 1628
8
2
8
0 26
8
2
8
0 1253
8
2
8
0 455
8
2
8
0 986
8
2
8
0 772
8
2
8
0 1473
8
2
8
0 951
8
2
8
0 807
8
2
8
0 994
8
2
8
0 1414
8
2
8
0 835
8
2
8
0 1161
8
2
8
0 1068
8
2
8
1 1068
8
0 65
8
2
8
0 1403
8
2
8
0 167
8
2
8
0 530
8
2
8
0 746
8
2
8
1 746
8
0 1520
8
2
8
0 673
8
2
8
1 673
8
0 231
8
2
8
0 9...

result:

points 0.6220 points  0.6220

Test #83:

score: 46.65
Acceptable Answer
time: 13ms
memory: 3888kb

input:

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

output:

8
0 1226
8
2
8
0 208
8
2
8
0 683
8
2
8
0 372
8
2
8
0 323
8
2
8
0 1818
8
2
8
0 283
8
2
8
0 851
8
2
8
0 986
8
2
8
0 622
8
2
8
0 1848
8
2
8
0 77
8
2
8
0 53
8
2
8
0 1690
8
2
8
1 1690
8
0 1624
8
2
8
1 1624
8
0 743
8
2
8
0 613
8
2
8
1 613
8
0 386
8
2
8
0 81
8
2
8
0 840
8
2
8
0 1769
8
2
8
0 1953
8
2
8
1 19...

result:

points 0.6220 points  0.6220

Test #84:

score: 49.8
Acceptable Answer
time: 20ms
memory: 3912kb

input:

540
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 3
8
2
8
0 424
8
2
8
0 444
8
2
8
1 444
8
0 378
8
2
8
1 378
8
0 463
8
2
8
1 463
8
0 118
8
2
8
0 334
8
2
8
1 334
8
0 257
8
2
8
1 257
8
0 485
8
2
8
0 139
8
2
8
1 139
8
0 301
8
2
8
1 301
8
0 122
8
2
8
1 122
8
0 204
8
2
8
1 204
8
0 121
8
2
8
1 121
8
0 298
8
2
8
1 298
8
0 205
8
2
8
1 205
8
0 35
8
2
8
1...

result:

points 0.6640 points  0.6640

Test #85:

score: 35.13
Acceptable Answer
time: 19ms
memory: 3976kb

input:

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

output:

8
0 657
8
2
8
0 1612
8
2
8
1 1612
8
0 879
8
2
8
1 879
8
0 378
8
2
8
1 378
8
0 463
8
2
8
1 463
8
0 1352
8
2
8
0 782
8
2
8
1 782
8
0 693
8
2
8
1 693
8
0 1024
8
2
8
1 1024
8
0 650
8
2
8
1 650
8
0 1414
8
2
8
1 1414
8
0 1401
8
2
8
1 1401
8
0 1364
8
2
8
1 1364
8
0 690
8
2
8
1 690
8
0 1154
8
2
8
1 1154
8
0...

result:

points 0.46840 points  0.46840

Test #86:

score: 25.03
Acceptable Answer
time: 33ms
memory: 3920kb

input:

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

output:

8
0 657
8
2
8
0 1612
8
2
8
0 879
8
2
8
1 879
8
0 378
8
2
8
1 378
8
0 463
8
2
8
1 463
8
0 1953
8
2
8
1 1953
8
0 782
8
2
8
1 782
8
0 693
8
2
8
1 693
8
0 1024
8
2
8
1 1024
8
0 650
8
2
8
1 650
8
0 1414
8
2
8
1 1414
8
0 1401
8
2
8
1 1401
8
0 1364
8
2
8
1 1364
8
0 690
8
2
8
1 690
8
0 1154
8
2
8
1 1154
8
0...

result:

points 0.33373333330 points  0.33373333330

Test #87:

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

input:

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

output:

8
0 824
8
2
8
0 1906
8
2
8
0 26
8
2
8
1 26
8
0 1265
8
2
8
0 1395
8
2
8
0 1642
8
2
8
0 1994
8
2
8
0 192
8
2
8
1 192
8
0 1577
8
2
8
0 236
8
2
8
1 236
8
0 166
8
2
8
1 166
8
0 828
8
2
8
1 828
8
0 949
8
2
8
1 949
8
0 338
8
2
8
1 338
8
0 1193
8
2
8
0 660
8
2
8
1 660
8
0 299
8
2
8
1 299
8
0 1344
8
2
8
0 71...

result:

ok 

Test #88:

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

input:

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

output:

8
0 1577
8
2
8
0 800
8
2
8
0 1183
8
2
8
1 1183
8
0 1340
8
2
8
1 1340
8
0 1751
8
2
8
1 1751
8
0 1746
8
2
8
1 1746
8
0 1856
8
2
8
1 1856
8
0 1590
8
2
8
1 1590
8
0 1213
8
2
8
1 1213
8
0 1280
8
2
8
1 1280
8
0 956
8
2
8
0 1638
8
2
8
1 1638
8
0 1178
8
2
8
1 1178
8
0 259
8
2
8
0 1075
8
2
8
1 1075
8
0 1755
...

result:

ok 

Test #89:

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

input:

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

output:

8
0 1577
8
2
8
0 800
8
2
8
0 1183
8
2
8
0 1340
8
2
8
0 1751
8
2
8
1 1751
8
0 1746
8
2
8
1 1746
8
0 1856
8
2
8
1 1856
8
0 1590
8
2
8
1 1590
8
0 1213
8
2
8
0 1280
8
2
8
0 956
8
2
8
0 1638
8
2
8
1 1638
8
0 1178
8
2
8
0 259
8
2
8
1 259
8
0 1075
8
2
8
0 1755
8
2
8
1 1755
8
0 411
8
2
8
1 411
8
0 1813
8
2
...

result:

ok