QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#430049#4565. Rarest Insectsjames1BadCreeper#47.51 40ms4164kbC++171.5kb2024-06-03 12:09:482024-06-03 12:09:49

Judging History

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

  • [2024-06-03 12:09:49]
  • 评测
  • 测评结果:47.51
  • 用时:40ms
  • 内存:4164kb
  • [2024-06-03 12:09: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 : arr)
                    if (in[i]) Move_outside(i), in[i] = 0; 
                return 0; 
            }
        }
    }
    for (int i : arr)
        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
// 直接扫,

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

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

output:

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

result:

ok 

Test #2:

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

input:

2
1
2
2
2

output:

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

result:

ok 

Test #3:

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

input:

2
1
1

output:

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

result:

ok 

Test #4:

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

input:

3
1
2
1
2

output:

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

result:

ok 

Test #5:

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

input:

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

output:

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

result:

ok 

Test #6:

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

input:

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

output:

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

result:

ok 

Test #7:

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

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 175
8
2
8
0 22
8
2
8
1 22
8
0 145
8
2
8
1 145
8
0 32
8
2
8
1 32
8
0 43
8
2
8
1 43
8
0 47
8
2
8
1 47
8
0 14
8
2
8
1 14
8
0 103
8
2
8
1 103
8
0 92
8
2
8
1 92
8
0 164
8
2
8
1 164
8
0 37
8
2
8
1 37
8
0 71
8
2
8
1 71
8
0 48
8
2
8
1 48
8
0 156
8
2
8
1 156
8
0 2
8
2
8
1 2
8
0 186
8
2
8
1 186
8
0 85
8
2...

result:

ok 

Test #8:

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

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 174
8
2
8
0 141
8
2
8
0 144
8
2
8
0 53
8
2
8
0 42
8
2
8
0 119
8
2
8
0 189
8
2
8
0 159
8
2
8
0 143
8
2
8
0 69
8
2
8
0 36
8
2
8
0 70
8
2
8
0 91
8
2
8
0 137
8
2
8
0 8
8
2
8
0 105
8
2
8
0 84
8
2
8
0 198
8
2
8
0 52
8
2
8
0 28
8
2
8
0 158
8
2
8
0 114
8
2
8
0 21
8
2
8
0 81
8
2
8
0 71
8
2
8
0 13
8
2
8
0...

result:

ok 

Test #9:

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

input:

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

output:

8
0 174
8
2
8
0 141
8
2
8
0 144
8
2
8
0 53
8
2
8
0 42
8
2
8
0 119
8
2
8
0 189
8
2
8
0 159
8
2
8
1 159
8
0 143
8
2
8
0 69
8
2
8
1 69
8
0 36
8
2
8
0 70
8
2
8
1 70
8
0 91
8
2
8
1 91
8
0 137
8
2
8
0 8
8
2
8
1 8
8
0 105
8
2
8
1 105
8
0 84
8
2
8
0 198
8
2
8
1 198
8
0 52
8
2
8
1 52
8
0 28
8
2
8
0 158
8
2
8...

result:

ok 

Test #10:

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

input:

198
1
1
1
1
1
1
2
2
1
2
2
1
1
2
2
2
2
2
2
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 174
8
2
8
0 141
8
2
8
0 144
8
2
8
0 53
8
2
8
0 42
8
2
8
0 119
8
2
8
0 189
8
2
8
1 189
8
0 159
8
2
8
1 159
8
0 143
8
2
8
0 69
8
2
8
1 69
8
0 36
8
2
8
1 36
8
0 70
8
2
8
0 91
8
2
8
0 137
8
2
8
1 137
8
0 8
8
2
8
1 8
8
0 105
8
2
8
1 105
8
0 84
8
2
8
1 84
8
0 173
8
2
8
1 173
8
0 52
8
2
8
1 52
8
0 28
8...

result:

ok 

Test #11:

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

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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 155
8
2
8
0 37
8
2
8
1 37
8
0 82
8
2
8
1 82
8
0 167
8
2
8
1 167
8
0 13
8
2
8
1 13
8
0 125
8
2
8
1 125
8
0 185
8
2
8
1 185
8
0 29
8
2
8
1 29
8
0 192
8
2
8
1 192
8
0 39
8
2
8
1 39
8
0 56
8
2
8
1 56
8
0 163
8
2
8
1 163
8
0 21
8
2
8
1 21
8
0 46
8
2
8
1 46
8
0 6
8
2
8
1 6
8
0 25
8
2
8
1 25
8
0 48
8
2...

result:

ok 

Test #12:

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

input:

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

output:

8
0 155
8
2
8
0 37
8
2
8
0 82
8
2
8
0 167
8
2
8
1 167
8
0 13
8
2
8
0 125
8
2
8
0 185
8
2
8
0 29
8
2
8
1 29
8
0 192
8
2
8
1 192
8
0 39
8
2
8
0 56
8
2
8
0 163
8
2
8
1 163
8
0 21
8
2
8
0 46
8
2
8
0 6
8
2
8
0 25
8
2
8
0 48
8
2
8
1 48
8
0 96
8
2
8
0 116
8
2
8
0 139
8
2
8
1 139
8
0 124
8
2
8
1 124
8
0 54
...

result:

ok 

Test #13:

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

input:

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

output:

8
0 155
8
2
8
0 37
8
2
8
1 37
8
0 82
8
2
8
0 167
8
2
8
0 13
8
2
8
1 13
8
0 125
8
2
8
0 185
8
2
8
1 185
8
0 29
8
2
8
1 29
8
0 192
8
2
8
1 192
8
0 39
8
2
8
1 39
8
0 56
8
2
8
1 56
8
0 163
8
2
8
1 163
8
0 21
8
2
8
1 21
8
0 46
8
2
8
1 46
8
0 6
8
2
8
1 6
8
0 25
8
2
8
1 25
8
0 48
8
2
8
1 48
8
0 96
8
2
8
1 ...

result:

ok 

Test #14:

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

input:

198
1
1
1
1
1
1
2
1
2
2
2
1
2
1
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
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 191
8
2
8
0 59
8
2
8
0 80
8
2
8
0 166
8
2
8
0 55
8
2
8
0 143
8
2
8
0 184
8
2
8
1 184
8
0 107
8
2
8
0 190
8
2
8
1 190
8
0 91
8
2
8
1 91
8
0 33
8
2
8
1 33
8
0 162
8
2
8
0 8
8
2
8
1 8
8
0 27
8
2
8
0 163
8
2
8
1 163
8
0 153
8
2
8
1 153
8
0 69
8
2
8
0 60
8
2
8
0 177
8
2
8
1 177
8
0 138
8
2
8
1 138
8
...

result:

ok 

Test #15:

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

input:

200
1
1
1
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 191
8
2
8
0 59
8
2
8
0 80
8
2
8
0 166
8
2
8
1 166
8
0 55
8
2
8
1 55
8
0 143
8
2
8
0 184
8
2
8
1 184
8
0 107
8
2
8
0 190
8
2
8
1 190
8
0 91
8
2
8
1 91
8
0 33
8
2
8
1 33
8
0 162
8
2
8
1 162
8
0 8
8
2
8
1 8
8
0 27
8
2
8
1 27
8
0 163
8
2
8
1 163
8
0 153
8
2
8
1 153
8
0 69
8
2
8
1 69
8
0 60
8
2
8
1 6...

result:

ok 

Test #16:

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

input:

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

output:

8
0 191
8
2
8
0 59
8
2
8
0 80
8
2
8
0 166
8
2
8
0 55
8
2
8
0 143
8
2
8
0 184
8
2
8
1 184
8
0 107
8
2
8
0 190
8
2
8
1 190
8
0 91
8
2
8
1 91
8
0 33
8
2
8
1 33
8
0 162
8
2
8
1 162
8
0 8
8
2
8
1 8
8
0 27
8
2
8
1 27
8
0 163
8
2
8
1 163
8
0 153
8
2
8
1 153
8
0 69
8
2
8
1 69
8
0 60
8
2
8
1 60
8
0 177
8
2
8...

result:

ok 

Test #17:

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

input:

199
1
1
1
1
2
1
1
2
2
2
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 155
8
2
8
0 37
8
2
8
0 82
8
2
8
0 167
8
2
8
0 13
8
2
8
1 13
8
0 125
8
2
8
0 185
8
2
8
0 29
8
2
8
1 29
8
0 192
8
2
8
1 192
8
0 39
8
2
8
1 39
8
0 56
8
2
8
1 56
8
0 163
8
2
8
0 21
8
2
8
1 21
8
0 46
8
2
8
1 46
8
0 6
8
2
8
0 25
8
2
8
1 25
8
0 48
8
2
8
1 48
8
0 96
8
2
8
1 96
8
0 116
8
2
8
0 139
8
2
8
...

result:

ok 

Test #18:

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

input:

196
1
1
1
1
1
1
2
2
1
2
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 191
8
2
8
0 59
8
2
8
0 80
8
2
8
0 166
8
2
8
0 55
8
2
8
0 143
8
2
8
0 184
8
2
8
1 184
8
0 107
8
2
8
1 107
8
0 190
8
2
8
0 91
8
2
8
1 91
8
0 33
8
2
8
0 162
8
2
8
0 8
8
2
8
1 8
8
0 27
8
2
8
1 27
8
0 163
8
2
8
1 163
8
0 153
8
2
8
1 153
8
0 69
8
2
8
0 60
8
2
8
1 60
8
0 177
8
2
8
0 138
8
2
8
1 138
8
0...

result:

ok 

Test #19:

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

input:

196
1
1
1
1
2
2
1
1
2
1
2
1
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
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 191
8
2
8
0 59
8
2
8
0 80
8
2
8
0 166
8
2
8
0 55
8
2
8
1 55
8
0 143
8
2
8
1 143
8
0 184
8
2
8
0 107
8
2
8
0 190
8
2
8
1 190
8
0 91
8
2
8
0 33
8
2
8
1 33
8
0 162
8
2
8
0 8
8
2
8
1 8
8
0 27
8
2
8
0 163
8
2
8
1 163
8
0 153
8
2
8
1 153
8
0 69
8
2
8
0 60
8
2
8
1 60
8
0 177
8
2
8
0 138
8
2
8
0 90
8
2
...

result:

ok 

Test #20:

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

input:

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

output:

8
0 191
8
2
8
0 59
8
2
8
1 59
8
0 80
8
2
8
0 166
8
2
8
0 55
8
2
8
0 143
8
2
8
1 143
8
0 184
8
2
8
0 107
8
2
8
1 107
8
0 190
8
2
8
0 91
8
2
8
0 33
8
2
8
0 162
8
2
8
1 162
8
0 8
8
2
8
1 8
8
0 27
8
2
8
1 27
8
0 163
8
2
8
0 153
8
2
8
0 69
8
2
8
1 69
8
0 60
8
2
8
0 177
8
2
8
0 138
8
2
8
1 138
8
0 90
8
2
...

result:

ok 

Test #21:

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

input:

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

output:

8
0 191
8
2
8
0 59
8
2
8
0 80
8
2
8
0 166
8
2
8
0 55
8
2
8
0 143
8
2
8
0 184
8
2
8
0 107
8
2
8
0 190
8
2
8
0 91
8
2
8
0 33
8
2
8
0 162
8
2
8
0 8
8
2
8
0 27
8
2
8
1 27
8
0 163
8
2
8
0 153
8
2
8
0 69
8
2
8
0 60
8
2
8
0 177
8
2
8
0 138
8
2
8
0 90
8
2
8
1 90
8
0 34
8
2
8
1 34
8
0 48
8
2
8
0 106
8
2
8
1 ...

result:

ok 

Test #22:

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

input:

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

output:

8
0 155
8
2
8
0 37
8
2
8
0 82
8
2
8
0 167
8
2
8
0 13
8
2
8
0 125
8
2
8
0 185
8
2
8
0 29
8
2
8
0 192
8
2
8
0 39
8
2
8
0 56
8
2
8
0 163
8
2
8
1 163
8
0 21
8
2
8
1 21
8
0 46
8
2
8
0 6
8
2
8
0 25
8
2
8
0 48
8
2
8
0 96
8
2
8
0 116
8
2
8
1 116
8
0 139
8
2
8
0 124
8
2
8
0 54
8
2
8
1 54
8
0 182
8
2
8
0 190
...

result:

ok 

Test #23:

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

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

output:

8
0 191
8
2
8
0 59
8
2
8
0 80
8
2
8
0 166
8
2
8
0 55
8
2
8
0 143
8
2
8
0 184
8
2
8
0 107
8
2
8
0 190
8
2
8
0 91
8
2
8
0 33
8
2
8
0 162
8
2
8
0 8
8
2
8
0 27
8
2
8
0 163
8
2
8
0 153
8
2
8
0 69
8
2
8
0 60
8
2
8
0 177
8
2
8
0 138
8
2
8
0 90
8
2
8
0 34
8
2
8
0 48
8
2
8
0 106
8
2
8
0 37
8
2
8
0 147
8
2
8
...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

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

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 191
8
2
8
0 923
8
2
8
1 923
8
0 232
8
2
8
1 232
8
0 166
8
2
8
1 166
8
0 334
8
2
8
1 334
8
0 921
8
2
8
1 921
8
0 662
8
2
8
1 662
8
0 498
8
2
8
1 498
8
0 190
8
2
8
1 190
8
0 255
8
2
8
1 255
8
0 33
8
2
8
1 33
8
0 550
8
2
8
1 550
8
0 829
8
2
8
1 829
8
0 761
8
2
8
1 761
8
0 589
8
2
8
1 589
8
0 879
8
...

result:

ok 

Test #25:

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

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 191
8
2
8
0 923
8
2
8
0 232
8
2
8
0 166
8
2
8
0 334
8
2
8
0 921
8
2
8
0 662
8
2
8
0 498
8
2
8
0 190
8
2
8
0 255
8
2
8
0 33
8
2
8
0 550
8
2
8
0 829
8
2
8
0 761
8
2
8
0 589
8
2
8
0 879
8
2
8
0 362
8
2
8
0 968
8
2
8
0 688
8
2
8
0 958
8
2
8
0 870
8
2
8
0 954
8
2
8
0 48
8
2
8
0 106
8
2
8
0 947
8
2
8
...

result:

ok 

Test #26:

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

input:

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

output:

8
0 326
8
2
8
0 834
8
2
8
0 233
8
2
8
0 332
8
2
8
0 335
8
2
8
0 588
8
2
8
0 932
8
2
8
0 499
8
2
8
0 260
8
2
8
1 260
8
0 39
8
2
8
0 496
8
2
8
1 496
8
0 551
8
2
8
0 434
8
2
8
0 365
8
2
8
0 427
8
2
8
1 427
8
0 25
8
2
8
0 363
8
2
8
0 969
8
2
8
1 969
8
0 689
8
2
8
0 959
8
2
8
1 959
8
0 988
8
2
8
1 988
8
...

result:

ok 

Test #27:

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

input:

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

output:

8
0 622
8
2
8
0 227
8
2
8
0 130
8
2
8
0 745
8
2
8
0 662
8
2
8
0 493
8
2
8
0 11
8
2
8
0 411
8
2
8
0 475
8
2
8
0 47
8
2
8
0 920
8
2
8
1 920
8
0 741
8
2
8
0 830
8
2
8
0 131
8
2
8
0 412
8
2
8
0 550
8
2
8
0 304
8
2
8
0 24
8
2
8
0 786
8
2
8
1 786
8
0 417
8
2
8
0 327
8
2
8
1 327
8
0 236
8
2
8
1 236
8
0 231...

result:

ok 

Test #28:

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

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 675
8
2
8
0 226
8
2
8
1 226
8
0 103
8
2
8
1 103
8
0 744
8
2
8
1 744
8
0 287
8
2
8
1 287
8
0 492
8
2
8
1 492
8
0 751
8
2
8
1 751
8
0 411
8
2
8
1 411
8
0 755
8
2
8
1 755
8
0 681
8
2
8
1 681
8
0 597
8
2
8
1 597
8
0 740
8
2
8
1 740
8
0 951
8
2
8
1 951
8
0 130
8
2
8
1 130
8
0 909
8
2
8
1 909
8
0 394
...

result:

ok 

Test #29:

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

input:

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

output:

8
0 622
8
2
8
0 227
8
2
8
0 130
8
2
8
1 130
8
0 745
8
2
8
1 745
8
0 662
8
2
8
1 662
8
0 493
8
2
8
0 11
8
2
8
0 411
8
2
8
0 475
8
2
8
1 475
8
0 47
8
2
8
0 920
8
2
8
1 920
8
0 741
8
2
8
1 741
8
0 830
8
2
8
0 131
8
2
8
1 131
8
0 412
8
2
8
0 550
8
2
8
1 550
8
0 304
8
2
8
1 304
8
0 24
8
2
8
1 24
8
0 786
...

result:

ok 

Test #30:

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

input:

998
1
1
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 675
8
2
8
0 226
8
2
8
0 103
8
2
8
1 103
8
0 744
8
2
8
1 744
8
0 287
8
2
8
0 492
8
2
8
1 492
8
0 751
8
2
8
1 751
8
0 411
8
2
8
0 755
8
2
8
1 755
8
0 681
8
2
8
1 681
8
0 597
8
2
8
1 597
8
0 740
8
2
8
1 740
8
0 951
8
2
8
1 951
8
0 130
8
2
8
1 130
8
0 909
8
2
8
1 909
8
0 394
8
2
8
1 394
8
0 290
8
2
...

result:

ok 

Test #31:

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

input:

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

output:

8
0 403
8
2
8
0 355
8
2
8
0 754
8
2
8
0 356
8
2
8
1 356
8
0 202
8
2
8
0 248
8
2
8
0 301
8
2
8
0 901
8
2
8
0 447
8
2
8
0 139
8
2
8
0 727
8
2
8
0 109
8
2
8
1 109
8
0 398
8
2
8
0 133
8
2
8
0 983
8
2
8
1 983
8
0 942
8
2
8
1 942
8
0 414
8
2
8
1 414
8
0 496
8
2
8
1 496
8
0 660
8
2
8
0 567
8
2
8
1 567
8
0 ...

result:

ok 

Test #32:

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

input:

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

output:

8
0 403
8
2
8
0 355
8
2
8
1 355
8
0 754
8
2
8
0 356
8
2
8
1 356
8
0 202
8
2
8
0 248
8
2
8
0 301
8
2
8
1 301
8
0 901
8
2
8
1 901
8
0 447
8
2
8
1 447
8
0 139
8
2
8
1 139
8
0 727
8
2
8
1 727
8
0 109
8
2
8
1 109
8
0 398
8
2
8
0 133
8
2
8
1 133
8
0 983
8
2
8
1 983
8
0 942
8
2
8
1 942
8
0 414
8
2
8
1 414
...

result:

ok 

Test #33:

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

input:

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

output:

8
0 403
8
2
8
0 355
8
2
8
0 754
8
2
8
0 356
8
2
8
0 202
8
2
8
0 248
8
2
8
1 248
8
0 301
8
2
8
1 301
8
0 901
8
2
8
0 447
8
2
8
0 139
8
2
8
1 139
8
0 727
8
2
8
0 109
8
2
8
1 109
8
0 398
8
2
8
1 398
8
0 133
8
2
8
1 133
8
0 983
8
2
8
1 983
8
0 942
8
2
8
1 942
8
0 414
8
2
8
1 414
8
0 496
8
2
8
1 496
8
0 ...

result:

ok 

Test #34:

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

input:

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

output:

8
0 403
8
2
8
0 355
8
2
8
1 355
8
0 754
8
2
8
1 754
8
0 356
8
2
8
0 202
8
2
8
0 248
8
2
8
0 301
8
2
8
0 901
8
2
8
1 901
8
0 447
8
2
8
0 139
8
2
8
0 727
8
2
8
0 109
8
2
8
1 109
8
0 398
8
2
8
0 133
8
2
8
1 133
8
0 983
8
2
8
1 983
8
0 942
8
2
8
1 942
8
0 414
8
2
8
1 414
8
0 496
8
2
8
0 660
8
2
8
1 660
...

result:

ok 

Test #35:

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

input:

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

output:

8
0 763
8
2
8
0 780
8
2
8
0 63
8
2
8
0 573
8
2
8
0 451
8
2
8
0 366
8
2
8
0 759
8
2
8
0 236
8
2
8
1 236
8
0 272
8
2
8
0 831
8
2
8
1 831
8
0 827
8
2
8
1 827
8
0 809
8
2
8
1 809
8
0 321
8
2
8
0 392
8
2
8
1 392
8
0 889
8
2
8
1 889
8
0 801
8
2
8
0 803
8
2
8
1 803
8
0 968
8
2
8
0 653
8
2
8
1 653
8
0 854
8...

result:

ok 

Test #36:

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

input:

997
1
1
1
1
1
2
1
1
2
2
1
1
2
1
2
2
1
2
2
2
1
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 285
8
2
8
0 781
8
2
8
0 184
8
2
8
0 527
8
2
8
0 322
8
2
8
0 450
8
2
8
1 450
8
0 419
8
2
8
0 237
8
2
8
0 273
8
2
8
1 273
8
0 239
8
2
8
1 239
8
0 770
8
2
8
0 359
8
2
8
0 137
8
2
8
1 137
8
0 592
8
2
8
0 246
8
2
8
1 246
8
0 396
8
2
8
1 396
8
0 884
8
2
8
0 969
8
2
8
1 969
8
0 599
8
2
8
1 599
8
0 855
...

result:

ok 

Test #37:

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

input:

995
1
1
1
1
1
2
2
1
1
2
2
1
1
2
1
1
2
1
1
2
1
2
2
2
1
2
1
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 285
8
2
8
0 781
8
2
8
0 184
8
2
8
0 527
8
2
8
0 322
8
2
8
0 450
8
2
8
1 450
8
0 419
8
2
8
1 419
8
0 237
8
2
8
0 273
8
2
8
0 239
8
2
8
1 239
8
0 770
8
2
8
1 770
8
0 359
8
2
8
0 137
8
2
8
0 592
8
2
8
1 592
8
0 246
8
2
8
0 396
8
2
8
0 884
8
2
8
1 884
8
0 969
8
2
8
0 599
8
2
8
0 855
8
2
8
1 855
8
0 ...

result:

ok 

Test #38:

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

input:

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

output:

8
0 285
8
2
8
0 781
8
2
8
0 184
8
2
8
0 527
8
2
8
0 322
8
2
8
1 322
8
0 450
8
2
8
0 419
8
2
8
1 419
8
0 237
8
2
8
0 273
8
2
8
0 239
8
2
8
0 770
8
2
8
0 359
8
2
8
1 359
8
0 137
8
2
8
0 592
8
2
8
0 246
8
2
8
0 396
8
2
8
0 884
8
2
8
1 884
8
0 969
8
2
8
0 599
8
2
8
0 855
8
2
8
0 282
8
2
8
0 846
8
2
8
0 ...

result:

ok 

Test #39:

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

input:

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

output:

8
0 910
8
2
8
0 193
8
2
8
0 756
8
2
8
0 647
8
2
8
0 711
8
2
8
0 309
8
2
8
0 375
8
2
8
0 40
8
2
8
0 273
8
2
8
0 92
8
2
8
0 43
8
2
8
0 602
8
2
8
0 581
8
2
8
0 520
8
2
8
1 520
8
0 538
8
2
8
0 147
8
2
8
0 554
8
2
8
0 809
8
2
8
0 51
8
2
8
1 51
8
0 270
8
2
8
1 270
8
0 661
8
2
8
0 397
8
2
8
1 397
8
0 981
8...

result:

ok 

Test #40:

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

input:

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

output:

8
0 167
8
2
8
0 947
8
2
8
0 437
8
2
8
0 646
8
2
8
0 710
8
2
8
0 308
8
2
8
0 374
8
2
8
0 163
8
2
8
0 929
8
2
8
0 889
8
2
8
0 42
8
2
8
0 52
8
2
8
1 52
8
0 580
8
2
8
0 460
8
2
8
0 99
8
2
8
0 146
8
2
8
0 193
8
2
8
0 819
8
2
8
0 723
8
2
8
0 271
8
2
8
0 660
8
2
8
0 396
8
2
8
1 396
8
0 980
8
2
8
0 355
8
2
...

result:

ok 

Test #41:

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

input:

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

output:

8
0 910
8
2
8
0 193
8
2
8
0 756
8
2
8
0 647
8
2
8
0 711
8
2
8
0 309
8
2
8
0 375
8
2
8
0 40
8
2
8
0 273
8
2
8
0 92
8
2
8
0 43
8
2
8
0 602
8
2
8
0 581
8
2
8
0 520
8
2
8
0 538
8
2
8
0 147
8
2
8
0 554
8
2
8
0 809
8
2
8
0 51
8
2
8
0 270
8
2
8
0 661
8
2
8
0 397
8
2
8
0 981
8
2
8
0 206
8
2
8
0 473
8
2
8
0 ...

result:

ok 

Test #42:

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

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

output:

8
0 910
8
2
8
0 193
8
2
8
0 756
8
2
8
0 647
8
2
8
0 711
8
2
8
0 309
8
2
8
0 375
8
2
8
0 40
8
2
8
0 273
8
2
8
0 92
8
2
8
0 43
8
2
8
0 602
8
2
8
0 581
8
2
8
0 520
8
2
8
0 538
8
2
8
0 147
8
2
8
0 554
8
2
8
0 809
8
2
8
0 51
8
2
8
0 270
8
2
8
0 661
8
2
8
0 397
8
2
8
0 981
8
2
8
0 206
8
2
8
1 206
8
0 473
...

result:

ok 

Subtask #3:

score: 22.51
Acceptable Answer

Test #43:

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

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

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

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

input:

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

output:

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

result:

ok 

Test #47:

score: 74.17
Acceptable Answer
time: 1ms
memory: 3904kb

input:

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

output:

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

result:

points 0.98893333330 points  0.98893333330

Test #48:

score: 22.51
Acceptable Answer
time: 11ms
memory: 3872kb

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 1719
8
2
8
0 947
8
2
8
1 947
8
0 1934
8
2
8
1 1934
8
0 646
8
2
8
1 646
8
0 1001
8
2
8
1 1001
8
0 308
8
2
8
1 308
8
0 1731
8
2
8
1 1731
8
0 163
8
2
8
1 163
8
0 1828
8
2
8
1 1828
8
0 1576
8
2
8
1 1576
8
0 1033
8
2
8
1 1033
8
0 52
8
2
8
1 52
8
0 580
8
2
8
1 580
8
0 460
8
2
8
1 460
8
0 1915
8
2
8
1 ...

result:

points 0.30013333330 points  0.30013333330

Test #49:

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

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 537
8
2
8
0 596
8
2
8
0 1676
8
2
8
0 1222
8
2
8
0 211
8
2
8
0 1831
8
2
8
0 735
8
2
8
0 1210
8
2
8
0 530
8
2
8
0 780
8
2
8
0 1713
8
2
8
0 209
8
2
8
0 486
8
2
8
0 1353
8
2
8
0 1155
8
2
8
0 66
8
2
8
0 1398
8
2
8
0 1619
8
2
8
0 19
8
2
8
0 1577
8
2
8
0 39
8
2
8
0 857
8
2
8
0 165
8
2
8
0 1765
8
2
8
0 ...

result:

ok 

Test #50:

score: 46.22
Acceptable Answer
time: 12ms
memory: 3908kb

input:

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

output:

8
0 537
8
2
8
0 596
8
2
8
0 1676
8
2
8
0 1222
8
2
8
0 211
8
2
8
0 1831
8
2
8
0 735
8
2
8
0 1210
8
2
8
1 1210
8
0 530
8
2
8
0 780
8
2
8
0 1713
8
2
8
0 209
8
2
8
0 486
8
2
8
0 1353
8
2
8
0 1155
8
2
8
0 66
8
2
8
1 66
8
0 1398
8
2
8
1 1398
8
0 1619
8
2
8
0 19
8
2
8
0 1577
8
2
8
0 39
8
2
8
0 857
8
2
8
1 ...

result:

points 0.61626666670 points  0.61626666670

Test #51:

score: 58.2
Acceptable Answer
time: 15ms
memory: 3928kb

input:

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

output:

8
0 1103
8
2
8
0 1407
8
2
8
0 1032
8
2
8
0 1462
8
2
8
0 787
8
2
8
0 1693
8
2
8
0 1998
8
2
8
0 416
8
2
8
0 584
8
2
8
0 237
8
2
8
0 436
8
2
8
0 914
8
2
8
1 914
8
0 1442
8
2
8
1 1442
8
0 321
8
2
8
0 145
8
2
8
0 938
8
2
8
1 938
8
0 1178
8
2
8
0 1623
8
2
8
0 1710
8
2
8
1 1710
8
0 354
8
2
8
1 354
8
0 795
...

result:

points 0.7760 points  0.7760

Test #52:

score: 26.47
Acceptable Answer
time: 18ms
memory: 3912kb

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 1103
8
2
8
0 1407
8
2
8
1 1407
8
0 1032
8
2
8
1 1032
8
0 1462
8
2
8
1 1462
8
0 787
8
2
8
1 787
8
0 1693
8
2
8
1 1693
8
0 1998
8
2
8
1 1998
8
0 416
8
2
8
1 416
8
0 584
8
2
8
1 584
8
0 237
8
2
8
1 237
8
0 436
8
2
8
1 436
8
0 914
8
2
8
1 914
8
0 1442
8
2
8
1 1442
8
0 321
8
2
8
1 321
8
0 145
8
2
8
1...

result:

points 0.35293333330 points  0.35293333330

Test #53:

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

input:

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

output:

8
0 1212
8
2
8
0 188
8
2
8
0 927
8
2
8
1 927
8
0 1986
8
2
8
1 1986
8
0 1825
8
2
8
0 1809
8
2
8
0 980
8
2
8
0 814
8
2
8
0 1047
8
2
8
1 1047
8
0 36
8
2
8
0 619
8
2
8
1 619
8
0 971
8
2
8
1 971
8
0 347
8
2
8
0 1722
8
2
8
1 1722
8
0 829
8
2
8
0 1173
8
2
8
0 960
8
2
8
1 960
8
0 1622
8
2
8
0 1782
8
2
8
0 4...

result:

ok 

Test #54:

score: 28.88
Acceptable Answer
time: 30ms
memory: 3820kb

input:

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

output:

8
0 1212
8
2
8
0 188
8
2
8
1 188
8
0 927
8
2
8
0 1986
8
2
8
0 1825
8
2
8
1 1825
8
0 1809
8
2
8
0 980
8
2
8
1 980
8
0 814
8
2
8
1 814
8
0 1047
8
2
8
1 1047
8
0 36
8
2
8
1 36
8
0 619
8
2
8
1 619
8
0 971
8
2
8
1 971
8
0 347
8
2
8
1 347
8
0 1722
8
2
8
1 1722
8
0 829
8
2
8
1 829
8
0 1173
8
2
8
1 1173
8
0...

result:

points 0.38506666670 points  0.38506666670

Test #55:

score: 58
Acceptable Answer
time: 17ms
memory: 3908kb

input:

2000
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
2
2
1
1
2
2
2
1
1
2
2
1
2
2
1
2
1
2
2
1
2
2
1
1
2
2
1
2
2
1
2
2
2
2
1
1
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
1
1
2
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1510
8
2
8
0 1198
8
2
8
0 797
8
2
8
0 199
8
2
8
0 1412
8
2
8
1 1412
8
0 1700
8
2
8
0 1333
8
2
8
0 845
8
2
8
0 1961
8
2
8
0 581
8
2
8
0 1320
8
2
8
0 422
8
2
8
0 1358
8
2
8
0 1680
8
2
8
0 326
8
2
8
0 646
8
2
8
0 1639
8
2
8
0 1027
8
2
8
0 585
8
2
8
0 1382
8
2
8
1 1382
8
0 254
8
2
8
0 1721
8
2
8
0 1...

result:

points 0.77333333330 points  0.77333333330

Test #56:

score: 32.3
Acceptable Answer
time: 40ms
memory: 3896kb

input:

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

output:

8
0 1510
8
2
8
0 1198
8
2
8
0 797
8
2
8
1 797
8
0 199
8
2
8
0 1412
8
2
8
1 1412
8
0 1700
8
2
8
1 1700
8
0 1333
8
2
8
0 845
8
2
8
1 845
8
0 1961
8
2
8
1 1961
8
0 581
8
2
8
1 581
8
0 1320
8
2
8
1 1320
8
0 422
8
2
8
0 1358
8
2
8
1 1358
8
0 1680
8
2
8
1 1680
8
0 326
8
2
8
1 326
8
0 646
8
2
8
1 646
8
0 1...

result:

points 0.43066666670 points  0.43066666670

Test #57:

score: 32.32
Acceptable Answer
time: 21ms
memory: 3812kb

input:

1999
1
1
1
2
1
2
2
2
2
2
2
1
1
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1001
8
2
8
0 219
8
2
8
0 786
8
2
8
0 1910
8
2
8
1 1910
8
0 1597
8
2
8
0 749
8
2
8
1 749
8
0 336
8
2
8
1 336
8
0 221
8
2
8
1 221
8
0 1885
8
2
8
1 1885
8
0 1520
8
2
8
1 1520
8
0 1030
8
2
8
1 1030
8
0 131
8
2
8
0 1415
8
2
8
0 1206
8
2
8
0 1174
8
2
8
1 1174
8
0 1848
8
2
8
1 1848
8
0 669
8
2
8
1 669
...

result:

points 0.43093333330 points  0.43093333330

Test #58:

score: 32.35
Acceptable Answer
time: 31ms
memory: 3888kb

input:

1997
1
1
1
1
2
2
1
1
2
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1001
8
2
8
0 219
8
2
8
0 786
8
2
8
0 1910
8
2
8
0 1597
8
2
8
1 1597
8
0 749
8
2
8
1 749
8
0 336
8
2
8
0 221
8
2
8
0 1885
8
2
8
1 1885
8
0 1520
8
2
8
1 1520
8
0 1030
8
2
8
0 131
8
2
8
1 131
8
0 1415
8
2
8
0 1206
8
2
8
1 1206
8
0 1174
8
2
8
1 1174
8
0 1848
8
2
8
1 1848
8
0 669
8
2
8
1 669
8
0 564
...

result:

points 0.43133333330 points  0.43133333330

Test #59:

score: 37.79
Acceptable Answer
time: 5ms
memory: 3892kb

input:

1998
1
2
1
2
1
1
1
1
2
1
2
1
2
1
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1300
8
2
8
0 1162
8
2
8
1 1162
8
0 1339
8
2
8
0 845
8
2
8
1 845
8
0 1156
8
2
8
0 265
8
2
8
0 1261
8
2
8
0 615
8
2
8
0 338
8
2
8
1 338
8
0 40
8
2
8
0 583
8
2
8
1 583
8
0 1321
8
2
8
0 317
8
2
8
1 317
8
0 1630
8
2
8
0 1658
8
2
8
1 1658
8
0 274
8
2
8
1 274
8
0 1013
8
2
8
0 216
8
2
8
0 922
8
2
8
1 92...

result:

points 0.50386666670 points  0.50386666670

Test #60:

score: 32.42
Acceptable Answer
time: 25ms
memory: 3892kb

input:

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

output:

8
0 1300
8
2
8
0 1162
8
2
8
0 1339
8
2
8
0 845
8
2
8
0 1156
8
2
8
0 265
8
2
8
0 1261
8
2
8
0 615
8
2
8
1 615
8
0 338
8
2
8
0 40
8
2
8
1 40
8
0 583
8
2
8
1 583
8
0 1321
8
2
8
1 1321
8
0 317
8
2
8
0 1630
8
2
8
0 1658
8
2
8
1 1658
8
0 274
8
2
8
1 274
8
0 1013
8
2
8
1 1013
8
0 216
8
2
8
0 922
8
2
8
1 92...

result:

points 0.43226666670 points  0.43226666670

Test #61:

score: 37.97
Acceptable Answer
time: 23ms
memory: 3876kb

input:

2000
1
1
1
1
1
2
1
1
2
1
1
2
1
2
2
1
2
2
1
1
1
2
2
1
1
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1409
8
2
8
0 860
8
2
8
0 1278
8
2
8
0 1041
8
2
8
0 1043
8
2
8
0 1416
8
2
8
1 1416
8
0 1875
8
2
8
0 1062
8
2
8
0 1156
8
2
8
1 1156
8
0 1564
8
2
8
0 1049
8
2
8
0 1288
8
2
8
1 1288
8
0 1472
8
2
8
0 796
8
2
8
1 796
8
0 192
8
2
8
1 192
8
0 259
8
2
8
0 1108
8
2
8
1 1108
8
0 1989
8
2
8
1 1989
8
0 271
8...

result:

points 0.50626666670 points  0.50626666670

Test #62:

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

input:

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

output:

8
0 1165
8
2
8
0 1398
8
2
8
0 749
8
2
8
0 385
8
2
8
0 1172
8
2
8
0 1297
8
2
8
0 1311
8
2
8
0 32
8
2
8
1 32
8
0 1518
8
2
8
1 1518
8
0 1
8
2
8
0 1804
8
2
8
0 368
8
2
8
0 496
8
2
8
0 1132
8
2
8
0 653
8
2
8
0 1046
8
2
8
0 638
8
2
8
0 1015
8
2
8
0 1722
8
2
8
1 1722
8
0 242
8
2
8
0 354
8
2
8
0 369
8
2
8
0...

result:

points 0.77386666670 points  0.77386666670

Test #63:

score: 65.68
Acceptable Answer
time: 5ms
memory: 3844kb

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

output:

8
0 1165
8
2
8
0 1398
8
2
8
0 749
8
2
8
0 385
8
2
8
0 1172
8
2
8
0 1297
8
2
8
0 1311
8
2
8
0 32
8
2
8
0 1518
8
2
8
0 1
8
2
8
0 1804
8
2
8
0 368
8
2
8
0 496
8
2
8
0 1132
8
2
8
0 653
8
2
8
0 1046
8
2
8
0 638
8
2
8
0 1015
8
2
8
0 1722
8
2
8
0 242
8
2
8
0 354
8
2
8
0 369
8
2
8
0 1580
8
2
8
0 1751
8
2
8
...

result:

points 0.87573333330 points  0.87573333330

Test #64:

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

input:

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

output:

8
0 459
8
2
8
0 1399
8
2
8
0 790
8
2
8
0 1524
8
2
8
0 1314
8
2
8
0 819
8
2
8
0 110
8
2
8
0 722
8
2
8
0 1519
8
2
8
0 1434
8
2
8
0 1805
8
2
8
0 1350
8
2
8
0 497
8
2
8
0 1680
8
2
8
0 266
8
2
8
0 1047
8
2
8
0 639
8
2
8
0 61
8
2
8
0 1723
8
2
8
0 243
8
2
8
0 355
8
2
8
0 440
8
2
8
0 1581
8
2
8
0 949
8
2
8
...

result:

points 0.95866666670 points  0.95866666670

Test #65:

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

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

output:

8
0 1265
8
2
8
0 22
8
2
8
0 1639
8
2
8
0 1009
8
2
8
0 1627
8
2
8
0 39
8
2
8
0 1569
8
2
8
0 1805
8
2
8
0 821
8
2
8
0 229
8
2
8
0 1367
8
2
8
0 1147
8
2
8
0 554
8
2
8
0 1098
8
2
8
0 934
8
2
8
0 1832
8
2
8
0 1230
8
2
8
0 315
8
2
8
0 5
8
2
8
0 247
8
2
8
0 1812
8
2
8
0 1281
8
2
8
0 112
8
2
8
0 1723
8
2
8
...

result:

ok 

Test #66:

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

input:

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

output:

8
0 1264
8
2
8
0 669
8
2
8
0 1638
8
2
8
0 1008
8
2
8
0 1626
8
2
8
0 539
8
2
8
0 1568
8
2
8
0 1804
8
2
8
0 820
8
2
8
0 1803
8
2
8
0 1366
8
2
8
0 1146
8
2
8
0 4
8
2
8
0 1529
8
2
8
0 9
8
2
8
0 547
8
2
8
0 1543
8
2
8
0 1759
8
2
8
0 28
8
2
8
0 246
8
2
8
0 1765
8
2
8
0 1280
8
2
8
0 13
8
2
8
0 1722
8
2
8
0...

result:

ok 

Test #67:

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

input:

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

output:

8
0 1265
8
2
8
0 22
8
2
8
0 1639
8
2
8
0 1009
8
2
8
0 1627
8
2
8
0 39
8
2
8
0 1569
8
2
8
0 1805
8
2
8
0 821
8
2
8
0 229
8
2
8
0 1367
8
2
8
0 1147
8
2
8
0 554
8
2
8
0 1098
8
2
8
0 934
8
2
8
0 1832
8
2
8
0 1230
8
2
8
0 315
8
2
8
0 5
8
2
8
0 247
8
2
8
0 1812
8
2
8
0 1281
8
2
8
0 112
8
2
8
0 1723
8
2
8
...

result:

ok 

Test #68:

score: 46.7
Acceptable Answer
time: 5ms
memory: 3888kb

input:

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

output:

8
0 1265
8
2
8
0 22
8
2
8
0 1639
8
2
8
0 1009
8
2
8
0 1627
8
2
8
0 39
8
2
8
0 1569
8
2
8
0 1805
8
2
8
1 1805
8
0 821
8
2
8
0 229
8
2
8
0 1367
8
2
8
0 1147
8
2
8
1 1147
8
0 554
8
2
8
0 1098
8
2
8
0 934
8
2
8
0 1832
8
2
8
0 1230
8
2
8
0 315
8
2
8
0 5
8
2
8
0 247
8
2
8
0 1812
8
2
8
0 1281
8
2
8
1 1281
...

result:

points 0.62266666670 points  0.62266666670

Test #69:

score: 46.7
Acceptable Answer
time: 29ms
memory: 3880kb

input:

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

output:

8
0 1935
8
2
8
0 1482
8
2
8
0 970
8
2
8
0 505
8
2
8
0 843
8
2
8
0 1615
8
2
8
0 1794
8
2
8
0 106
8
2
8
1 106
8
0 1327
8
2
8
0 1963
8
2
8
0 1186
8
2
8
0 1281
8
2
8
0 435
8
2
8
1 435
8
0 1134
8
2
8
0 182
8
2
8
0 809
8
2
8
1 809
8
0 1579
8
2
8
0 1317
8
2
8
0 1126
8
2
8
1 1126
8
0 1890
8
2
8
0 1686
8
2
8...

result:

points 0.62266666670 points  0.62266666670

Test #70:

score: 38.18
Acceptable Answer
time: 9ms
memory: 3872kb

input:

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

output:

8
0 1935
8
2
8
0 1482
8
2
8
0 970
8
2
8
0 505
8
2
8
0 843
8
2
8
0 1615
8
2
8
0 1794
8
2
8
0 106
8
2
8
0 1327
8
2
8
0 1963
8
2
8
0 1186
8
2
8
0 1281
8
2
8
0 435
8
2
8
0 1134
8
2
8
1 1134
8
0 182
8
2
8
0 809
8
2
8
1 809
8
0 1579
8
2
8
1 1579
8
0 1317
8
2
8
1 1317
8
0 1126
8
2
8
0 1890
8
2
8
1 1890
8
0...

result:

points 0.50906666670 points  0.50906666670

Test #71:

score: 38.18
Acceptable Answer
time: 22ms
memory: 4160kb

input:

1979
1
1
2
1
1
2
1
2
1
2
1
1
1
1
1
1
1
2
2
1
2
1
2
2
1
1
1
1
1
1
1
2
2
1
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
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
1
2
2
2
2
2
2
2
2
2
2
2
2
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 1911
8
2
8
0 299
8
2
8
0 1198
8
2
8
1 1198
8
0 1748
8
2
8
0 163
8
2
8
0 1766
8
2
8
1 1766
8
0 1306
8
2
8
0 269
8
2
8
1 269
8
0 1542
8
2
8
0 820
8
2
8
1 820
8
0 1792
8
2
8
0 1866
8
2
8
0 1442
8
2
8
0 1301
8
2
8
0 703
8
2
8
0 1191
8
2
8
0 1668
8
2
8
0 1397
8
2
8
1 1397
8
0 864
8
2
8
1 864
8
0 493
...

result:

points 0.50906666670 points  0.50906666670

Test #72:

score: 58.24
Acceptable Answer
time: 7ms
memory: 3668kb

input:

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

output:

8
0 1911
8
2
8
0 299
8
2
8
0 1198
8
2
8
0 1748
8
2
8
0 163
8
2
8
0 1766
8
2
8
0 1306
8
2
8
0 269
8
2
8
0 1542
8
2
8
1 1542
8
0 820
8
2
8
0 1792
8
2
8
0 1866
8
2
8
1 1866
8
0 1442
8
2
8
0 1301
8
2
8
0 703
8
2
8
0 1191
8
2
8
0 1668
8
2
8
0 1397
8
2
8
0 864
8
2
8
0 493
8
2
8
0 1589
8
2
8
1 1589
8
0 150...

result:

points 0.77653333330 points  0.77653333330

Test #73:

score: 58.24
Acceptable Answer
time: 8ms
memory: 3848kb

input:

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

output:

8
0 1665
8
2
8
0 1889
8
2
8
0 682
8
2
8
0 1527
8
2
8
0 1840
8
2
8
0 577
8
2
8
0 1542
8
2
8
1 1542
8
0 1467
8
2
8
0 83
8
2
8
0 1220
8
2
8
1 1220
8
0 1714
8
2
8
0 1875
8
2
8
0 549
8
2
8
0 1294
8
2
8
1 1294
8
0 1133
8
2
8
0 674
8
2
8
1 674
8
0 1925
8
2
8
0 814
8
2
8
1 814
8
0 1471
8
2
8
0 937
8
2
8
0 1...

result:

points 0.77653333330 points  0.77653333330

Test #74:

score: 65.89
Acceptable Answer
time: 18ms
memory: 4140kb

input:

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

output:

8
0 1665
8
2
8
0 1889
8
2
8
0 682
8
2
8
0 1527
8
2
8
0 1840
8
2
8
0 577
8
2
8
0 1542
8
2
8
0 1467
8
2
8
0 83
8
2
8
0 1220
8
2
8
0 1714
8
2
8
0 1875
8
2
8
1 1875
8
0 549
8
2
8
0 1294
8
2
8
0 1133
8
2
8
0 674
8
2
8
0 1925
8
2
8
0 814
8
2
8
0 1471
8
2
8
0 937
8
2
8
0 1854
8
2
8
0 1284
8
2
8
0 615
8
2
8...

result:

points 0.87853333330 points  0.87853333330

Test #75:

score: 65.89
Acceptable Answer
time: 3ms
memory: 4136kb

input:

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

output:

8
0 1665
8
2
8
0 1889
8
2
8
0 682
8
2
8
0 1527
8
2
8
0 1840
8
2
8
0 577
8
2
8
0 1542
8
2
8
0 1467
8
2
8
0 83
8
2
8
0 1220
8
2
8
0 1714
8
2
8
0 1875
8
2
8
1 1875
8
0 549
8
2
8
0 1294
8
2
8
0 1133
8
2
8
0 674
8
2
8
0 1925
8
2
8
0 814
8
2
8
0 1471
8
2
8
0 937
8
2
8
0 1854
8
2
8
0 1284
8
2
8
0 615
8
2
8...

result:

points 0.87853333330 points  0.87853333330

Test #76:

score: 46.65
Acceptable Answer
time: 27ms
memory: 3880kb

input:

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

output:

8
0 78
8
2
8
0 803
8
2
8
0 511
8
2
8
0 1349
8
2
8
0 1351
8
2
8
0 804
8
2
8
0 46
8
2
8
0 474
8
2
8
0 1497
8
2
8
0 1067
8
2
8
0 1740
8
2
8
0 1831
8
2
8
0 374
8
2
8
0 1476
8
2
8
0 81
8
2
8
0 147
8
2
8
0 807
8
2
8
0 1408
8
2
8
1 1408
8
0 1365
8
2
8
0 1525
8
2
8
0 903
8
2
8
0 399
8
2
8
0 1914
8
2
8
1 191...

result:

points 0.6220 points  0.6220

Test #77:

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

input:

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

output:

8
0 78
8
2
8
0 803
8
2
8
0 511
8
2
8
0 1349
8
2
8
0 1351
8
2
8
0 804
8
2
8
0 46
8
2
8
0 474
8
2
8
1 474
8
0 1497
8
2
8
0 1067
8
2
8
0 1740
8
2
8
1 1740
8
0 1831
8
2
8
0 374
8
2
8
0 1476
8
2
8
0 81
8
2
8
0 147
8
2
8
1 147
8
0 807
8
2
8
0 1408
8
2
8
0 1365
8
2
8
0 1525
8
2
8
0 903
8
2
8
1 903
8
0 399
...

result:

points 0.6220 points  0.6220

Test #78:

score: 58.23
Acceptable Answer
time: 0ms
memory: 4140kb

input:

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

output:

8
0 1522
8
2
8
0 1471
8
2
8
0 766
8
2
8
0 1735
8
2
8
0 629
8
2
8
0 1266
8
2
8
0 425
8
2
8
0 318
8
2
8
0 1724
8
2
8
0 1502
8
2
8
1 1502
8
0 931
8
2
8
0 1968
8
2
8
0 156
8
2
8
0 91
8
2
8
0 413
8
2
8
0 1440
8
2
8
1 1440
8
0 949
8
2
8
0 96
8
2
8
0 941
8
2
8
0 1780
8
2
8
0 396
8
2
8
0 203
8
2
8
0 146
8
2...

result:

points 0.77640 points  0.77640

Test #79:

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

input:

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

output:

8
0 1522
8
2
8
0 1471
8
2
8
0 766
8
2
8
0 1735
8
2
8
0 629
8
2
8
0 1266
8
2
8
0 425
8
2
8
0 318
8
2
8
0 1724
8
2
8
0 1502
8
2
8
1 1502
8
0 931
8
2
8
0 1968
8
2
8
0 156
8
2
8
0 91
8
2
8
0 413
8
2
8
0 1440
8
2
8
1 1440
8
0 949
8
2
8
0 96
8
2
8
0 941
8
2
8
0 1780
8
2
8
0 396
8
2
8
0 203
8
2
8
0 146
8
2...

result:

points 0.77640 points  0.77640

Test #80:

score: 59.3
Acceptable Answer
time: 17ms
memory: 3852kb

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

output:

8
0 1522
8
2
8
0 1471
8
2
8
0 766
8
2
8
0 1735
8
2
8
0 629
8
2
8
0 1266
8
2
8
0 425
8
2
8
0 318
8
2
8
0 1724
8
2
8
0 1502
8
2
8
0 931
8
2
8
0 1968
8
2
8
1 1968
8
0 156
8
2
8
0 91
8
2
8
0 413
8
2
8
0 1440
8
2
8
0 949
8
2
8
0 96
8
2
8
1 96
8
0 941
8
2
8
0 1780
8
2
8
0 396
8
2
8
0 203
8
2
8
1 203
8
0 1...

result:

points 0.79066666670 points  0.79066666670

Test #81:

score: 59.3
Acceptable Answer
time: 26ms
memory: 3912kb

input:

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

output:

8
0 1755
8
2
8
0 353
8
2
8
0 1256
8
2
8
0 1075
8
2
8
0 1424
8
2
8
0 776
8
2
8
0 1730
8
2
8
0 1536
8
2
8
0 1380
8
2
8
0 359
8
2
8
0 1601
8
2
8
0 1228
8
2
8
0 196
8
2
8
0 1326
8
2
8
0 1107
8
2
8
0 554
8
2
8
1 554
8
0 390
8
2
8
1 390
8
0 1487
8
2
8
0 1078
8
2
8
0 511
8
2
8
0 557
8
2
8
0 1644
8
2
8
0 78...

result:

points 0.79066666670 points  0.79066666670

Test #82:

score: 46.65
Acceptable Answer
time: 19ms
memory: 4136kb

input:

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

output:

8
0 1755
8
2
8
0 353
8
2
8
0 1256
8
2
8
0 1075
8
2
8
0 1424
8
2
8
0 776
8
2
8
0 1730
8
2
8
0 1536
8
2
8
0 1380
8
2
8
0 359
8
2
8
0 1601
8
2
8
0 1228
8
2
8
0 196
8
2
8
0 1326
8
2
8
0 1107
8
2
8
0 554
8
2
8
0 390
8
2
8
0 1487
8
2
8
0 1078
8
2
8
0 511
8
2
8
1 511
8
0 557
8
2
8
0 1644
8
2
8
0 785
8
2
8
...

result:

points 0.6220 points  0.6220

Test #83:

score: 46.65
Acceptable Answer
time: 16ms
memory: 3856kb

input:

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

output:

8
0 570
8
2
8
0 1196
8
2
8
0 56
8
2
8
0 349
8
2
8
0 1086
8
2
8
0 1230
8
2
8
0 1384
8
2
8
0 596
8
2
8
0 695
8
2
8
0 1303
8
2
8
0 946
8
2
8
0 1078
8
2
8
0 573
8
2
8
0 1358
8
2
8
0 1427
8
2
8
0 1707
8
2
8
0 897
8
2
8
1 897
8
0 724
8
2
8
0 106
8
2
8
1 106
8
0 758
8
2
8
0 159
8
2
8
0 1245
8
2
8
1 1245
8
...

result:

points 0.6220 points  0.6220

Test #84:

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

input:

540
1
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 2
8
2
8
0 451
8
2
8
1 451
8
0 56
8
2
8
1 56
8
0 349
8
2
8
1 349
8
0 99
8
2
8
1 99
8
0 209
8
2
8
0 218
8
2
8
0 335
8
2
8
1 335
8
0 347
8
2
8
1 347
8
0 468
8
2
8
1 468
8
0 300
8
2
8
1 300
8
0 147
8
2
8
1 147
8
0 53
8
2
8
1 53
8
0 426
8
2
8
0 269
8
2
8
1 269
8
0 65
8
2
8
1 65
8
0 353
8
2
8
1 353
8
...

result:

points 0.66560 points  0.66560

Test #85:

score: 35.13
Acceptable Answer
time: 33ms
memory: 3852kb

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

output:

8
0 570
8
2
8
0 1196
8
2
8
1 1196
8
0 56
8
2
8
0 349
8
2
8
1 349
8
0 1086
8
2
8
1 1086
8
0 1230
8
2
8
1 1230
8
0 1384
8
2
8
1 1384
8
0 596
8
2
8
1 596
8
0 695
8
2
8
1 695
8
0 1303
8
2
8
1 1303
8
0 946
8
2
8
1 946
8
0 1078
8
2
8
1 1078
8
0 573
8
2
8
1 573
8
0 1358
8
2
8
1 1358
8
0 1427
8
2
8
1 1427
8...

result:

points 0.46840 points  0.46840

Test #86:

score: 25.03
Acceptable Answer
time: 10ms
memory: 3880kb

input:

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

output:

8
0 1781
8
2
8
0 493
8
2
8
1 493
8
0 1045
8
2
8
0 537
8
2
8
1 537
8
0 148
8
2
8
1 148
8
0 670
8
2
8
1 670
8
0 650
8
2
8
1 650
8
0 1145
8
2
8
1 1145
8
0 688
8
2
8
1 688
8
0 1217
8
2
8
1 1217
8
0 1345
8
2
8
1 1345
8
0 536
8
2
8
1 536
8
0 575
8
2
8
1 575
8
0 1002
8
2
8
1 1002
8
0 1397
8
2
8
1 1397
8
0 ...

result:

points 0.33373333330 points  0.33373333330

Test #87:

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

input:

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

output:

8
0 1893
8
2
8
0 1697
8
2
8
0 267
8
2
8
0 1668
8
2
8
0 455
8
2
8
1 455
8
0 1900
8
2
8
0 249
8
2
8
1 249
8
0 432
8
2
8
1 432
8
0 688
8
2
8
1 688
8
0 995
8
2
8
1 995
8
0 1786
8
2
8
0 750
8
2
8
1 750
8
0 1144
8
2
8
0 693
8
2
8
1 693
8
0 1471
8
2
8
0 1596
8
2
8
0 1702
8
2
8
0 78
8
2
8
1 78
8
0 724
8
2
8...

result:

ok 

Test #88:

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

input:

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

output:

8
0 1893
8
2
8
0 1697
8
2
8
1 1697
8
0 267
8
2
8
0 1668
8
2
8
1 1668
8
0 455
8
2
8
0 1900
8
2
8
1 1900
8
0 249
8
2
8
0 432
8
2
8
0 688
8
2
8
0 995
8
2
8
0 1786
8
2
8
1 1786
8
0 750
8
2
8
0 1144
8
2
8
1 1144
8
0 693
8
2
8
0 1471
8
2
8
1 1471
8
0 1596
8
2
8
1 1596
8
0 1702
8
2
8
1 1702
8
0 78
8
2
8
0 ...

result:

ok 

Test #89:

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

input:

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

output:

8
0 1893
8
2
8
0 1697
8
2
8
1 1697
8
0 267
8
2
8
1 267
8
0 1668
8
2
8
1 1668
8
0 455
8
2
8
1 455
8
0 1900
8
2
8
1 1900
8
0 249
8
2
8
1 249
8
0 432
8
2
8
1 432
8
0 688
8
2
8
0 995
8
2
8
0 1786
8
2
8
1 1786
8
0 750
8
2
8
0 1144
8
2
8
0 693
8
2
8
0 1471
8
2
8
0 1596
8
2
8
1 1596
8
0 1702
8
2
8
1 1702
8...

result:

ok