QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#430035#4565. Rarest Insectsjames1BadCreeper#47.5 34ms4124kbC++171.7kb2024-06-03 11:48:522024-06-03 11:48:53

Judging History

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

  • [2024-06-03 11:48:53]
  • 评测
  • 测评结果:47.5
  • 用时:34ms
  • 内存:4124kb
  • [2024-06-03 11:48:52]
  • 提交

answer

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

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

input:

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

output:

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

result:

ok 

Test #2:

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

input:

2
1
2
1
2
1
2

output:

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

result:

ok 

Test #3:

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

input:

2
1
1
1
1

output:

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

result:

ok 

Test #4:

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

input:

3
1
1
2
1
1
2

output:

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

result:

ok 

Test #5:

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

input:

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

output:

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

result:

ok 

Test #6:

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

input:

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

output:

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

result:

ok 

Test #7:

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

input:

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

output:

8
0 195
8
2
8
0 84
8
2
8
1 84
8
0 122
8
2
8
1 122
8
0 116
8
2
8
1 116
8
0 159
8
2
8
1 159
8
0 38
8
2
8
1 38
8
0 153
8
2
8
1 153
8
0 188
8
2
8
1 188
8
0 59
8
2
8
1 59
8
0 191
8
2
8
1 191
8
0 98
8
2
8
1 98
8
0 24
8
2
8
1 24
8
0 77
8
2
8
1 77
8
0 118
8
2
8
1 118
8
0 49
8
2
8
1 49
8
0 161
8
2
8
1 161
8
...

result:

ok 

Test #8:

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

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 194
8
2
8
0 82
8
2
8
0 4
8
2
8
0 104
8
2
8
0 158
8
2
8
0 175
8
2
8
0 165
8
2
8
0 53
8
2
8
0 59
8
2
8
0 190
8
2
8
0 115
8
2
8
0 145
8
2
8
0 76
8
2
8
0 52
8
2
8
0 193
8
2
8
0 160
8
2
8
0 30
8
2
8
0 96
8
2
8
0 42
8
2
8
0 117
8
2
8
0 122
8
2
8
0 131
8
2
8
0 154
8
2
8
0 22
8
2
8
0 6
8
2
8
0 62
8
2
8
...

result:

ok 

Test #9:

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

input:

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

output:

8
0 194
8
2
8
0 82
8
2
8
0 4
8
2
8
0 104
8
2
8
0 158
8
2
8
0 175
8
2
8
0 165
8
2
8
1 165
8
0 53
8
2
8
1 53
8
0 59
8
2
8
0 190
8
2
8
1 190
8
0 115
8
2
8
1 115
8
0 145
8
2
8
0 76
8
2
8
0 52
8
2
8
1 52
8
0 193
8
2
8
1 193
8
0 160
8
2
8
1 160
8
0 30
8
2
8
1 30
8
0 96
8
2
8
0 42
8
2
8
1 42
8
0 117
8
2
8
...

result:

ok 

Test #10:

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

input:

198
1
1
1
1
1
2
2
1
1
1
1
2
2
2
2
2
2
2
1
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 194
8
2
8
0 82
8
2
8
0 4
8
2
8
0 104
8
2
8
0 158
8
2
8
0 175
8
2
8
1 175
8
0 165
8
2
8
1 165
8
0 53
8
2
8
0 59
8
2
8
0 190
8
2
8
0 115
8
2
8
0 145
8
2
8
1 145
8
0 76
8
2
8
1 76
8
0 52
8
2
8
1 52
8
0 193
8
2
8
1 193
8
0 160
8
2
8
1 160
8
0 30
8
2
8
1 30
8
0 96
8
2
8
1 96
8
0 42
8
2
8
0 117
8
2
8
...

result:

ok 

Test #11:

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

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

output:

8
0 195
8
2
8
0 84
8
2
8
1 84
8
0 122
8
2
8
1 122
8
0 116
8
2
8
1 116
8
0 159
8
2
8
1 159
8
0 38
8
2
8
1 38
8
0 153
8
2
8
1 153
8
0 188
8
2
8
1 188
8
0 59
8
2
8
1 59
8
0 191
8
2
8
1 191
8
0 98
8
2
8
1 98
8
0 24
8
2
8
1 24
8
0 77
8
2
8
1 77
8
0 118
8
2
8
1 118
8
0 49
8
2
8
1 49
8
0 161
8
2
8
1 161
8
...

result:

ok 

Test #12:

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

input:

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

output:

8
0 195
8
2
8
0 84
8
2
8
0 122
8
2
8
1 122
8
0 116
8
2
8
0 159
8
2
8
0 38
8
2
8
1 38
8
0 153
8
2
8
0 188
8
2
8
0 59
8
2
8
1 59
8
0 191
8
2
8
1 191
8
0 98
8
2
8
0 24
8
2
8
0 77
8
2
8
0 118
8
2
8
0 49
8
2
8
1 49
8
0 161
8
2
8
1 161
8
0 70
8
2
8
0 68
8
2
8
1 68
8
0 97
8
2
8
1 97
8
0 43
8
2
8
0 123
8
2
...

result:

ok 

Test #13:

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

input:

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

output:

8
0 195
8
2
8
0 84
8
2
8
0 122
8
2
8
0 116
8
2
8
1 116
8
0 159
8
2
8
1 159
8
0 38
8
2
8
0 153
8
2
8
1 153
8
0 188
8
2
8
1 188
8
0 59
8
2
8
1 59
8
0 191
8
2
8
1 191
8
0 98
8
2
8
1 98
8
0 24
8
2
8
1 24
8
0 77
8
2
8
1 77
8
0 118
8
2
8
1 118
8
0 49
8
2
8
1 49
8
0 161
8
2
8
1 161
8
0 70
8
2
8
1 70
8
0 68...

result:

ok 

Test #14:

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

input:

198
1
1
2
1
1
1
1
2
1
2
1
1
2
2
2
2
2
2
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 194
8
2
8
0 82
8
2
8
0 4
8
2
8
1 4
8
0 104
8
2
8
0 158
8
2
8
0 175
8
2
8
0 165
8
2
8
0 53
8
2
8
1 53
8
0 59
8
2
8
0 190
8
2
8
1 190
8
0 115
8
2
8
0 145
8
2
8
0 76
8
2
8
1 76
8
0 52
8
2
8
1 52
8
0 193
8
2
8
1 193
8
0 160
8
2
8
1 160
8
0 30
8
2
8
1 30
8
0 96
8
2
8
1 96
8
0 42
8
2
8
0 117
8
2
8
1 1...

result:

ok 

Test #15:

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

input:

200
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 194
8
2
8
0 82
8
2
8
0 4
8
2
8
0 104
8
2
8
0 158
8
2
8
1 158
8
0 175
8
2
8
1 175
8
0 165
8
2
8
1 165
8
0 53
8
2
8
1 53
8
0 59
8
2
8
0 190
8
2
8
1 190
8
0 115
8
2
8
1 115
8
0 145
8
2
8
1 145
8
0 76
8
2
8
1 76
8
0 52
8
2
8
1 52
8
0 193
8
2
8
1 193
8
0 160
8
2
8
1 160
8
0 30
8
2
8
1 30
8
0 96
8
2
8...

result:

ok 

Test #16:

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

input:

196
1
1
1
1
2
1
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 194
8
2
8
0 82
8
2
8
0 4
8
2
8
0 104
8
2
8
0 158
8
2
8
1 158
8
0 175
8
2
8
0 165
8
2
8
1 165
8
0 53
8
2
8
1 53
8
0 59
8
2
8
1 59
8
0 190
8
2
8
1 190
8
0 115
8
2
8
0 145
8
2
8
1 145
8
0 76
8
2
8
0 52
8
2
8
1 52
8
0 193
8
2
8
1 193
8
0 160
8
2
8
1 160
8
0 30
8
2
8
1 30
8
0 96
8
2
8
1 96
8
0 42
8
2...

result:

ok 

Test #17:

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

input:

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

output:

8
0 195
8
2
8
0 84
8
2
8
0 122
8
2
8
0 116
8
2
8
0 159
8
2
8
0 38
8
2
8
0 153
8
2
8
1 153
8
0 188
8
2
8
1 188
8
0 59
8
2
8
0 191
8
2
8
1 191
8
0 98
8
2
8
1 98
8
0 24
8
2
8
1 24
8
0 77
8
2
8
1 77
8
0 118
8
2
8
1 118
8
0 49
8
2
8
1 49
8
0 161
8
2
8
0 70
8
2
8
0 68
8
2
8
1 68
8
0 97
8
2
8
1 97
8
0 43
8...

result:

ok 

Test #18:

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

input:

196
1
1
2
1
1
2
1
1
2
1
1
1
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 194
8
2
8
0 82
8
2
8
0 4
8
2
8
1 4
8
0 104
8
2
8
0 158
8
2
8
0 175
8
2
8
1 175
8
0 165
8
2
8
0 53
8
2
8
0 59
8
2
8
1 59
8
0 190
8
2
8
0 115
8
2
8
0 145
8
2
8
0 76
8
2
8
1 76
8
0 52
8
2
8
1 52
8
0 193
8
2
8
1 193
8
0 160
8
2
8
1 160
8
0 30
8
2
8
0 96
8
2
8
1 96
8
0 42
8
2
8
1 42
8
0 117
8
2
8
1 1...

result:

ok 

Test #19:

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

input:

196
1
1
2
1
1
1
1
2
2
1
2
1
2
1
2
2
2
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 63
8
2
8
0 99
8
2
8
0 62
8
2
8
1 62
8
0 9
8
2
8
0 173
8
2
8
0 113
8
2
8
0 169
8
2
8
0 186
8
2
8
1 186
8
0 83
8
2
8
1 83
8
0 176
8
2
8
0 14
8
2
8
1 14
8
0 184
8
2
8
0 88
8
2
8
1 88
8
0 114
8
2
8
0 133
8
2
8
1 133
8
0 160
8
2
8
1 160
8
0 155
8
2
8
1 155
8
0 27
8
2
8
0 32
8
2
8
0 59
8
2
8
0 178
8
2...

result:

ok 

Test #20:

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

input:

196
1
1
1
1
1
2
1
1
1
2
2
2
2
1
1
2
2
2
2
2
2
2
2
1
2
2
2
2
1
2
2
2
1
2
2
1
2
2
2
2
2
2
2
1
2
1
2
1
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 63
8
2
8
0 99
8
2
8
0 62
8
2
8
0 9
8
2
8
0 173
8
2
8
0 113
8
2
8
1 113
8
0 169
8
2
8
0 186
8
2
8
0 83
8
2
8
0 176
8
2
8
1 176
8
0 14
8
2
8
1 14
8
0 184
8
2
8
1 184
8
0 88
8
2
8
1 88
8
0 114
8
2
8
0 133
8
2
8
0 160
8
2
8
1 160
8
0 155
8
2
8
1 155
8
0 27
8
2
8
1 27
8
0 32
8
2
8
1 32
8
0 59
8
2
8
1...

result:

ok 

Test #21:

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

input:

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

output:

8
0 63
8
2
8
0 99
8
2
8
0 62
8
2
8
0 9
8
2
8
0 173
8
2
8
0 113
8
2
8
0 169
8
2
8
0 186
8
2
8
0 83
8
2
8
0 176
8
2
8
0 14
8
2
8
0 184
8
2
8
0 88
8
2
8
0 114
8
2
8
0 133
8
2
8
0 160
8
2
8
0 155
8
2
8
0 27
8
2
8
1 27
8
0 32
8
2
8
0 59
8
2
8
1 59
8
0 178
8
2
8
0 87
8
2
8
0 138
8
2
8
0 35
8
2
8
0 68
8
2
...

result:

ok 

Test #22:

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

input:

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

output:

8
0 32
8
2
8
0 166
8
2
8
0 114
8
2
8
0 134
8
2
8
0 16
8
2
8
0 59
8
2
8
1 59
8
0 155
8
2
8
0 187
8
2
8
0 11
8
2
8
0 177
8
2
8
0 82
8
2
8
0 185
8
2
8
0 89
8
2
8
0 55
8
2
8
0 150
8
2
8
0 161
8
2
8
0 56
8
2
8
0 94
8
2
8
0 70
8
2
8
0 72
8
2
8
0 179
8
2
8
0 37
8
2
8
0 176
8
2
8
0 156
8
2
8
0 60
8
2
8
0 69...

result:

ok 

Test #23:

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

input:

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

output:

8
0 63
8
2
8
0 99
8
2
8
0 62
8
2
8
0 9
8
2
8
0 173
8
2
8
0 113
8
2
8
0 169
8
2
8
0 186
8
2
8
0 83
8
2
8
0 176
8
2
8
0 14
8
2
8
1 14
8
0 184
8
2
8
0 88
8
2
8
0 114
8
2
8
0 133
8
2
8
0 160
8
2
8
0 155
8
2
8
0 27
8
2
8
0 32
8
2
8
1 32
8
0 59
8
2
8
0 178
8
2
8
0 87
8
2
8
0 138
8
2
8
0 35
8
2
8
0 68
8
2
...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

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

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 308
8
2
8
0 277
8
2
8
1 277
8
0 888
8
2
8
1 888
8
0 381
8
2
8
1 381
8
0 438
8
2
8
1 438
8
0 113
8
2
8
1 113
8
0 729
8
2
8
1 729
8
0 740
8
2
8
1 740
8
0 769
8
2
8
1 769
8
0 957
8
2
8
1 957
8
0 890
8
2
8
1 890
8
0 184
8
2
8
1 184
8
0 88
8
2
8
1 88
8
0 813
8
2
8
1 813
8
0 815
8
2
8
1 815
8
0 349
8
...

result:

ok 

Test #25:

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

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 308
8
2
8
0 277
8
2
8
0 888
8
2
8
0 381
8
2
8
0 438
8
2
8
0 113
8
2
8
0 729
8
2
8
0 740
8
2
8
0 769
8
2
8
0 957
8
2
8
0 890
8
2
8
0 184
8
2
8
0 88
8
2
8
0 813
8
2
8
0 815
8
2
8
0 349
8
2
8
0 155
8
2
8
0 27
8
2
8
0 746
8
2
8
0 214
8
2
8
0 926
8
2
8
0 280
8
2
8
0 627
8
2
8
0 358
8
2
8
0 701
8
2
8
...

result:

ok 

Test #26:

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

input:

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

output:

8
0 309
8
2
8
0 203
8
2
8
0 889
8
2
8
0 820
8
2
8
0 564
8
2
8
0 434
8
2
8
0 437
8
2
8
0 741
8
2
8
0 11
8
2
8
0 527
8
2
8
0 891
8
2
8
0 768
8
2
8
0 720
8
2
8
0 282
8
2
8
0 670
8
2
8
1 670
8
0 253
8
2
8
1 253
8
0 924
8
2
8
1 924
8
0 94
8
2
8
1 94
8
0 747
8
2
8
0 514
8
2
8
1 514
8
0 927
8
2
8
0 37
8
2
...

result:

ok 

Test #27:

score: 0
Accepted
time: 20ms
memory: 4076kb

input:

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

output:

8
0 309
8
2
8
0 203
8
2
8
0 889
8
2
8
0 820
8
2
8
0 564
8
2
8
0 434
8
2
8
1 434
8
0 437
8
2
8
0 741
8
2
8
1 741
8
0 11
8
2
8
0 527
8
2
8
0 891
8
2
8
0 768
8
2
8
0 720
8
2
8
0 282
8
2
8
1 282
8
0 670
8
2
8
0 253
8
2
8
1 253
8
0 924
8
2
8
1 924
8
0 94
8
2
8
1 94
8
0 747
8
2
8
1 747
8
0 514
8
2
8
0 927...

result:

ok 

Test #28:

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

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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 865
8
2
8
0 268
8
2
8
1 268
8
0 762
8
2
8
1 762
8
0 334
8
2
8
1 334
8
0 486
8
2
8
1 486
8
0 170
8
2
8
1 170
8
0 107
8
2
8
1 107
8
0 473
8
2
8
1 473
8
0 206
8
2
8
1 206
8
0 57
8
2
8
1 57
8
0 756
8
2
8
1 756
8
0 681
8
2
8
1 681
8
0 457
8
2
8
1 457
8
0 290
8
2
8
1 290
8
0 279
8
2
8
1 279
8
0 551
8
...

result:

ok 

Test #29:

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

input:

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

output:

8
0 162
8
2
8
0 269
8
2
8
0 810
8
2
8
0 335
8
2
8
1 335
8
0 487
8
2
8
0 171
8
2
8
1 171
8
0 368
8
2
8
1 368
8
0 458
8
2
8
0 207
8
2
8
1 207
8
0 994
8
2
8
0 757
8
2
8
0 69
8
2
8
0 67
8
2
8
0 291
8
2
8
0 366
8
2
8
1 366
8
0 306
8
2
8
0 976
8
2
8
1 976
8
0 221
8
2
8
0 602
8
2
8
0 435
8
2
8
0 189
8
2
8
...

result:

ok 

Test #30:

score: 0
Accepted
time: 17ms
memory: 4076kb

input:

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

output:

8
0 865
8
2
8
0 268
8
2
8
0 762
8
2
8
1 762
8
0 334
8
2
8
0 486
8
2
8
1 486
8
0 170
8
2
8
0 107
8
2
8
1 107
8
0 473
8
2
8
1 473
8
0 206
8
2
8
1 206
8
0 57
8
2
8
1 57
8
0 756
8
2
8
1 756
8
0 681
8
2
8
1 681
8
0 457
8
2
8
1 457
8
0 290
8
2
8
1 290
8
0 279
8
2
8
1 279
8
0 551
8
2
8
1 551
8
0 379
8
2
8
...

result:

ok 

Test #31:

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

input:

998
1
1
1
1
1
1
1
1
1
1
2
2
1
2
2
2
1
1
1
1
1
2
2
1
2
1
2
2
2
2
2
1
2
2
2
2
2
2
1
2
1
1
1
2
1
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 865
8
2
8
0 268
8
2
8
0 762
8
2
8
0 334
8
2
8
0 486
8
2
8
0 170
8
2
8
0 107
8
2
8
0 473
8
2
8
0 206
8
2
8
0 57
8
2
8
0 756
8
2
8
1 756
8
0 681
8
2
8
1 681
8
0 457
8
2
8
0 290
8
2
8
1 290
8
0 279
8
2
8
1 279
8
0 551
8
2
8
1 551
8
0 379
8
2
8
0 555
8
2
8
0 535
8
2
8
0 434
8
2
8
0 783
8
2
8
0 207
8...

result:

ok 

Test #32:

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

input:

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

output:

8
0 295
8
2
8
0 310
8
2
8
0 321
8
2
8
1 321
8
0 328
8
2
8
0 38
8
2
8
1 38
8
0 684
8
2
8
0 528
8
2
8
0 206
8
2
8
1 206
8
0 29
8
2
8
1 29
8
0 955
8
2
8
1 955
8
0 654
8
2
8
1 654
8
0 900
8
2
8
1 900
8
0 833
8
2
8
1 833
8
0 337
8
2
8
1 337
8
0 957
8
2
8
1 957
8
0 640
8
2
8
1 640
8
0 519
8
2
8
1 519
8
0 ...

result:

ok 

Test #33:

score: 0
Accepted
time: 13ms
memory: 3820kb

input:

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

output:

8
0 295
8
2
8
0 310
8
2
8
0 321
8
2
8
0 328
8
2
8
0 38
8
2
8
1 38
8
0 684
8
2
8
0 528
8
2
8
1 528
8
0 206
8
2
8
0 29
8
2
8
1 29
8
0 955
8
2
8
1 955
8
0 654
8
2
8
1 654
8
0 900
8
2
8
1 900
8
0 833
8
2
8
1 833
8
0 337
8
2
8
1 337
8
0 957
8
2
8
1 957
8
0 640
8
2
8
0 519
8
2
8
1 519
8
0 125
8
2
8
1 125
...

result:

ok 

Test #34:

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

input:

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

output:

8
0 295
8
2
8
0 310
8
2
8
0 321
8
2
8
1 321
8
0 328
8
2
8
0 38
8
2
8
0 684
8
2
8
1 684
8
0 528
8
2
8
0 206
8
2
8
1 206
8
0 29
8
2
8
1 29
8
0 955
8
2
8
1 955
8
0 654
8
2
8
1 654
8
0 900
8
2
8
0 833
8
2
8
1 833
8
0 337
8
2
8
1 337
8
0 957
8
2
8
1 957
8
0 640
8
2
8
0 519
8
2
8
0 125
8
2
8
1 125
8
0 882...

result:

ok 

Test #35:

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

input:

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

output:

8
0 295
8
2
8
0 310
8
2
8
0 321
8
2
8
0 328
8
2
8
0 38
8
2
8
1 38
8
0 684
8
2
8
0 528
8
2
8
1 528
8
0 206
8
2
8
0 29
8
2
8
1 29
8
0 955
8
2
8
1 955
8
0 654
8
2
8
0 900
8
2
8
1 900
8
0 833
8
2
8
1 833
8
0 337
8
2
8
1 337
8
0 957
8
2
8
1 957
8
0 640
8
2
8
0 519
8
2
8
1 519
8
0 125
8
2
8
1 125
8
0 882
...

result:

ok 

Test #36:

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

input:

997
1
1
1
1
1
1
1
2
1
2
2
1
2
1
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 97
8
2
8
0 435
8
2
8
0 937
8
2
8
0 805
8
2
8
0 369
8
2
8
0 671
8
2
8
0 203
8
2
8
0 44
8
2
8
1 44
8
0 520
8
2
8
0 575
8
2
8
1 575
8
0 172
8
2
8
1 172
8
0 939
8
2
8
0 680
8
2
8
1 680
8
0 918
8
2
8
0 101
8
2
8
1 101
8
0 73
8
2
8
0 464
8
2
8
1 464
8
0 800
8
2
8
0 370
8
2
8
1 370
8
0 861
8
2
8
1 861
...

result:

ok 

Test #37:

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

input:

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

output:

8
0 97
8
2
8
0 435
8
2
8
0 937
8
2
8
0 805
8
2
8
0 369
8
2
8
1 369
8
0 671
8
2
8
0 203
8
2
8
1 203
8
0 44
8
2
8
0 520
8
2
8
0 575
8
2
8
0 172
8
2
8
1 172
8
0 939
8
2
8
0 680
8
2
8
1 680
8
0 918
8
2
8
0 101
8
2
8
1 101
8
0 73
8
2
8
1 73
8
0 464
8
2
8
0 800
8
2
8
0 370
8
2
8
0 861
8
2
8
1 861
8
0 683
...

result:

ok 

Test #38:

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

input:

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

output:

8
0 97
8
2
8
0 435
8
2
8
1 435
8
0 937
8
2
8
0 805
8
2
8
0 369
8
2
8
0 671
8
2
8
0 203
8
2
8
0 44
8
2
8
0 520
8
2
8
0 575
8
2
8
1 575
8
0 172
8
2
8
0 939
8
2
8
1 939
8
0 680
8
2
8
0 918
8
2
8
0 101
8
2
8
0 73
8
2
8
0 464
8
2
8
0 800
8
2
8
0 370
8
2
8
1 370
8
0 861
8
2
8
0 683
8
2
8
1 683
8
0 366
8
2...

result:

ok 

Test #39:

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

input:

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

output:

8
0 97
8
2
8
0 435
8
2
8
0 937
8
2
8
0 805
8
2
8
0 369
8
2
8
1 369
8
0 671
8
2
8
0 203
8
2
8
0 44
8
2
8
0 520
8
2
8
0 575
8
2
8
0 172
8
2
8
0 939
8
2
8
1 939
8
0 680
8
2
8
0 918
8
2
8
0 101
8
2
8
0 73
8
2
8
0 464
8
2
8
0 800
8
2
8
1 800
8
0 370
8
2
8
1 370
8
0 861
8
2
8
0 683
8
2
8
0 366
8
2
8
0 336...

result:

ok 

Test #40:

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

input:

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

output:

8
0 291
8
2
8
0 434
8
2
8
0 936
8
2
8
0 804
8
2
8
0 771
8
2
8
0 823
8
2
8
0 987
8
2
8
0 601
8
2
8
0 254
8
2
8
0 574
8
2
8
0 897
8
2
8
0 938
8
2
8
0 330
8
2
8
0 78
8
2
8
0 369
8
2
8
0 295
8
2
8
0 111
8
2
8
0 294
8
2
8
0 547
8
2
8
0 860
8
2
8
0 682
8
2
8
0 109
8
2
8
0 62
8
2
8
0 327
8
2
8
0 803
8
2
8
...

result:

ok 

Test #41:

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

input:

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

output:

8
0 681
8
2
8
0 790
8
2
8
0 651
8
2
8
0 104
8
2
8
0 735
8
2
8
0 80
8
2
8
0 135
8
2
8
0 617
8
2
8
0 254
8
2
8
0 350
8
2
8
0 781
8
2
8
0 386
8
2
8
0 872
8
2
8
1 872
8
0 79
8
2
8
0 496
8
2
8
0 247
8
2
8
0 518
8
2
8
0 793
8
2
8
0 51
8
2
8
0 692
8
2
8
1 692
8
0 779
8
2
8
0 63
8
2
8
0 156
8
2
8
0 598
8
2
...

result:

ok 

Test #42:

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

input:

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

output:

8
0 681
8
2
8
0 790
8
2
8
0 651
8
2
8
0 104
8
2
8
0 735
8
2
8
0 80
8
2
8
0 135
8
2
8
1 135
8
0 617
8
2
8
0 254
8
2
8
0 350
8
2
8
0 781
8
2
8
0 386
8
2
8
0 872
8
2
8
0 79
8
2
8
0 496
8
2
8
0 247
8
2
8
0 518
8
2
8
0 793
8
2
8
0 51
8
2
8
0 692
8
2
8
0 779
8
2
8
0 63
8
2
8
0 156
8
2
8
0 598
8
2
8
0 506
...

result:

ok 

Subtask #3:

score: 22.5
Acceptable Answer

Test #43:

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

input:

2
1
2
1
2
1
2

output:

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

result:

ok 

Test #44:

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

input:

2
1
1
1
1

output:

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

result:

ok 

Test #45:

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

input:

3
1
1
2
1
1
2

output:

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

result:

ok 

Test #46:

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

input:

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

output:

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

result:

ok 

Test #47:

score: 70.33
Acceptable Answer
time: 1ms
memory: 3808kb

input:

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

output:

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

result:

points 0.93773333330 points  0.93773333330

Test #48:

score: 22.5
Acceptable Answer
time: 24ms
memory: 3800kb

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 711
8
2
8
0 325
8
2
8
1 325
8
0 905
8
2
8
1 905
8
0 1130
8
2
8
1 1130
8
0 751
8
2
8
1 751
8
0 1079
8
2
8
1 1079
8
0 1560
8
2
8
1 1560
8
0 616
8
2
8
1 616
8
0 109
8
2
8
1 109
8
0 493
8
2
8
1 493
8
0 780
8
2
8
1 780
8
0 1959
8
2
8
1 1959
8
0 1401
8
2
8
1 1401
8
0 131
8
2
8
1 131
8
0 1266
8
2
8
1 1...

result:

points 0.30 points  0.30

Test #49:

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

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 1849
8
2
8
0 275
8
2
8
0 1343
8
2
8
0 625
8
2
8
0 866
8
2
8
0 1093
8
2
8
0 1959
8
2
8
0 1931
8
2
8
0 380
8
2
8
0 391
8
2
8
0 1482
8
2
8
0 1534
8
2
8
0 1038
8
2
8
0 849
8
2
8
0 865
8
2
8
0 1180
8
2
8
0 487
8
2
8
0 1089
8
2
8
0 411
8
2
8
0 1168
8
2
8
0 930
8
2
8
0 1687
8
2
8
0 281
8
2
8
0 1885
8
2...

result:

ok 

Test #50:

score: 45
Acceptable Answer
time: 22ms
memory: 4108kb

input:

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

output:

8
0 1849
8
2
8
0 275
8
2
8
0 1343
8
2
8
0 625
8
2
8
0 866
8
2
8
1 866
8
0 1093
8
2
8
0 1959
8
2
8
0 1931
8
2
8
0 380
8
2
8
0 391
8
2
8
0 1482
8
2
8
0 1534
8
2
8
0 1038
8
2
8
1 1038
8
0 849
8
2
8
0 865
8
2
8
1 865
8
0 1180
8
2
8
1 1180
8
0 487
8
2
8
0 1089
8
2
8
1 1089
8
0 411
8
2
8
1 411
8
0 1168
8
...

result:

points 0.60 points  0.60

Test #51:

score: 57.31
Acceptable Answer
time: 17ms
memory: 3888kb

input:

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

output:

8
0 1849
8
2
8
0 275
8
2
8
0 1343
8
2
8
0 625
8
2
8
0 866
8
2
8
0 1093
8
2
8
1 1093
8
0 1959
8
2
8
0 1931
8
2
8
0 380
8
2
8
0 391
8
2
8
0 1482
8
2
8
0 1534
8
2
8
0 1038
8
2
8
1 1038
8
0 849
8
2
8
0 865
8
2
8
0 1180
8
2
8
0 487
8
2
8
0 1089
8
2
8
0 411
8
2
8
1 411
8
0 1168
8
2
8
0 930
8
2
8
0 1687
8
...

result:

points 0.76413333330 points  0.76413333330

Test #52:

score: 26.43
Acceptable Answer
time: 25ms
memory: 3844kb

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 178
8
2
8
0 501
8
2
8
1 501
8
0 1727
8
2
8
1 1727
8
0 745
8
2
8
1 745
8
0 477
8
2
8
1 477
8
0 177
8
2
8
1 177
8
0 704
8
2
8
1 704
8
0 1505
8
2
8
1 1505
8
0 503
8
2
8
1 503
8
0 1956
8
2
8
1 1956
8
0 651
8
2
8
1 651
8
0 435
8
2
8
1 435
8
0 1472
8
2
8
1 1472
8
0 841
8
2
8
1 841
8
0 34
8
2
8
1 34
8
...

result:

points 0.35240 points  0.35240

Test #53:

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

input:

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

output:

8
0 178
8
2
8
0 501
8
2
8
0 1727
8
2
8
0 745
8
2
8
0 477
8
2
8
0 177
8
2
8
0 704
8
2
8
0 1505
8
2
8
0 503
8
2
8
0 1956
8
2
8
1 1956
8
0 651
8
2
8
0 435
8
2
8
0 1472
8
2
8
1 1472
8
0 841
8
2
8
1 841
8
0 34
8
2
8
1 34
8
0 957
8
2
8
1 957
8
0 163
8
2
8
1 163
8
0 1978
8
2
8
1 1978
8
0 368
8
2
8
1 368
8
...

result:

ok 

Test #54:

score: 28.8
Acceptable Answer
time: 18ms
memory: 4108kb

input:

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

output:

8
0 178
8
2
8
0 501
8
2
8
0 1727
8
2
8
0 745
8
2
8
0 477
8
2
8
1 477
8
0 177
8
2
8
1 177
8
0 704
8
2
8
1 704
8
0 1505
8
2
8
1 1505
8
0 503
8
2
8
1 503
8
0 1956
8
2
8
1 1956
8
0 651
8
2
8
1 651
8
0 435
8
2
8
1 435
8
0 1472
8
2
8
1 1472
8
0 841
8
2
8
1 841
8
0 34
8
2
8
1 34
8
0 957
8
2
8
1 957
8
0 163...

result:

points 0.3840 points  0.3840

Test #55:

score: 57.13
Acceptable Answer
time: 20ms
memory: 3836kb

input:

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

output:

8
0 902
8
2
8
0 340
8
2
8
0 347
8
2
8
0 1399
8
2
8
0 1742
8
2
8
0 939
8
2
8
0 1428
8
2
8
1 1428
8
0 204
8
2
8
0 16
8
2
8
0 852
8
2
8
0 499
8
2
8
0 1275
8
2
8
1 1275
8
0 192
8
2
8
0 1637
8
2
8
1 1637
8
0 1462
8
2
8
0 1353
8
2
8
1 1353
8
0 32
8
2
8
0 1357
8
2
8
0 1711
8
2
8
0 166
8
2
8
0 547
8
2
8
0 1...

result:

points 0.76173333330 points  0.76173333330

Test #56:

score: 32.2
Acceptable Answer
time: 17ms
memory: 3892kb

input:

1998
1
2
1
2
2
1
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 449
8
2
8
0 936
8
2
8
1 936
8
0 957
8
2
8
0 1291
8
2
8
1 1291
8
0 1260
8
2
8
1 1260
8
0 1901
8
2
8
0 252
8
2
8
1 252
8
0 480
8
2
8
0 1951
8
2
8
1 1951
8
0 1039
8
2
8
0 782
8
2
8
1 782
8
0 1762
8
2
8
1 1762
8
0 486
8
2
8
1 486
8
0 1942
8
2
8
1 1942
8
0 354
8
2
8
1 354
8
0 1592
8
2
8
1 1592
8
0 13...

result:

points 0.42933333330 points  0.42933333330

Test #57:

score: 32.17
Acceptable Answer
time: 34ms
memory: 3820kb

input:

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

output:

8
0 1022
8
2
8
0 937
8
2
8
0 760
8
2
8
0 1135
8
2
8
0 1261
8
2
8
1 1261
8
0 353
8
2
8
1 353
8
0 1476
8
2
8
1 1476
8
0 481
8
2
8
0 692
8
2
8
1 692
8
0 30
8
2
8
1 30
8
0 783
8
2
8
0 1763
8
2
8
0 764
8
2
8
1 764
8
0 1943
8
2
8
1 1943
8
0 355
8
2
8
1 355
8
0 1593
8
2
8
1 1593
8
0 1754
8
2
8
1 1754
8
0 1...

result:

points 0.42893333330 points  0.42893333330

Test #58:

score: 32.16
Acceptable Answer
time: 26ms
memory: 3824kb

input:

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

output:

8
0 1006
8
2
8
0 631
8
2
8
0 362
8
2
8
0 1592
8
2
8
0 1063
8
2
8
1 1063
8
0 1420
8
2
8
0 896
8
2
8
1 896
8
0 1082
8
2
8
1 1082
8
0 170
8
2
8
1 170
8
0 462
8
2
8
0 717
8
2
8
1 717
8
0 1254
8
2
8
1 1254
8
0 1141
8
2
8
0 814
8
2
8
1 814
8
0 239
8
2
8
0 305
8
2
8
0 87
8
2
8
1 87
8
0 217
8
2
8
1 217
8
0 ...

result:

points 0.42880 points  0.42880

Test #59:

score: 37.52
Acceptable Answer
time: 31ms
memory: 3824kb

input:

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

output:

8
0 808
8
2
8
0 366
8
2
8
0 1214
8
2
8
0 1441
8
2
8
0 1044
8
2
8
0 1598
8
2
8
1 1598
8
0 1643
8
2
8
0 1472
8
2
8
0 661
8
2
8
1 661
8
0 338
8
2
8
1 338
8
0 179
8
2
8
1 179
8
0 653
8
2
8
1 653
8
0 1053
8
2
8
1 1053
8
0 210
8
2
8
0 584
8
2
8
1 584
8
0 1639
8
2
8
0 68
8
2
8
1 68
8
0 840
8
2
8
1 840
8
0 ...

result:

points 0.50026666670 points  0.50026666670

Test #60:

score: 32.14
Acceptable Answer
time: 17ms
memory: 3820kb

input:

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

output:

8
0 808
8
2
8
0 366
8
2
8
0 1214
8
2
8
0 1441
8
2
8
0 1044
8
2
8
0 1598
8
2
8
0 1643
8
2
8
0 1472
8
2
8
0 661
8
2
8
1 661
8
0 338
8
2
8
0 179
8
2
8
1 179
8
0 653
8
2
8
1 653
8
0 1053
8
2
8
1 1053
8
0 210
8
2
8
0 584
8
2
8
0 1639
8
2
8
1 1639
8
0 68
8
2
8
0 840
8
2
8
1 840
8
0 1510
8
2
8
1 1510
8
0 1...

result:

points 0.42853333330 points  0.42853333330

Test #61:

score: 37.53
Acceptable Answer
time: 6ms
memory: 3832kb

input:

2000
1
1
1
1
1
1
2
1
1
2
2
1
1
1
2
2
1
2
2
1
1
2
2
2
2
2
1
2
2
2
1
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 933
8
2
8
0 1752
8
2
8
0 1315
8
2
8
0 440
8
2
8
0 925
8
2
8
0 270
8
2
8
0 237
8
2
8
1 237
8
0 1510
8
2
8
0 1725
8
2
8
0 317
8
2
8
1 317
8
0 926
8
2
8
1 926
8
0 1150
8
2
8
0 1942
8
2
8
0 1473
8
2
8
0 856
8
2
8
1 856
8
0 1638
8
2
8
1 1638
8
0 873
8
2
8
0 1257
8
2
8
1 1257
8
0 1579
8
2
8
1 1579
8
0...

result:

points 0.50040 points  0.50040

Test #62:

score: 57.05
Acceptable Answer
time: 23ms
memory: 3896kb

input:

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

output:

8
0 933
8
2
8
0 1752
8
2
8
0 1315
8
2
8
0 440
8
2
8
0 925
8
2
8
0 270
8
2
8
0 237
8
2
8
0 1510
8
2
8
1 1510
8
0 1725
8
2
8
0 317
8
2
8
1 317
8
0 926
8
2
8
1 926
8
0 1150
8
2
8
1 1150
8
0 1942
8
2
8
0 1473
8
2
8
1 1473
8
0 856
8
2
8
0 1638
8
2
8
0 873
8
2
8
1 873
8
0 1257
8
2
8
0 1579
8
2
8
0 1031
8
...

result:

points 0.76066666670 points  0.76066666670

Test #63:

score: 64.38
Acceptable Answer
time: 23ms
memory: 3848kb

input:

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

output:

8
0 805
8
2
8
0 56
8
2
8
0 1583
8
2
8
0 1799
8
2
8
0 1864
8
2
8
0 483
8
2
8
0 1414
8
2
8
0 799
8
2
8
0 1473
8
2
8
0 867
8
2
8
0 1792
8
2
8
0 344
8
2
8
0 314
8
2
8
0 803
8
2
8
0 790
8
2
8
0 440
8
2
8
0 1669
8
2
8
0 881
8
2
8
0 1373
8
2
8
1 1373
8
0 158
8
2
8
1 158
8
0 572
8
2
8
0 1387
8
2
8
0 1170
8
...

result:

points 0.85840 points  0.85840

Test #64:

score: 70.36
Acceptable Answer
time: 3ms
memory: 3780kb

input:

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

output:

8
0 1056
8
2
8
0 472
8
2
8
0 512
8
2
8
0 416
8
2
8
0 1865
8
2
8
0 79
8
2
8
0 1415
8
2
8
0 1136
8
2
8
0 134
8
2
8
1 134
8
0 876
8
2
8
0 1793
8
2
8
0 1738
8
2
8
0 358
8
2
8
0 482
8
2
8
0 791
8
2
8
0 441
8
2
8
0 625
8
2
8
0 1608
8
2
8
0 976
8
2
8
0 1116
8
2
8
0 1444
8
2
8
0 1896
8
2
8
0 1171
8
2
8
0 12...

result:

points 0.93813333330 points  0.93813333330

Test #65:

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

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

output:

8
0 1056
8
2
8
0 472
8
2
8
0 512
8
2
8
0 416
8
2
8
0 1865
8
2
8
0 79
8
2
8
0 1415
8
2
8
0 1136
8
2
8
0 134
8
2
8
0 876
8
2
8
0 1793
8
2
8
0 1738
8
2
8
0 358
8
2
8
0 482
8
2
8
0 791
8
2
8
0 441
8
2
8
0 625
8
2
8
0 1608
8
2
8
0 976
8
2
8
0 1116
8
2
8
0 1444
8
2
8
0 1896
8
2
8
0 1171
8
2
8
0 1225
8
2
8...

result:

ok 

Test #66:

score: 75
Accepted
time: 29ms
memory: 3740kb

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

output:

8
0 1581
8
2
8
0 1840
8
2
8
0 1301
8
2
8
0 1732
8
2
8
0 1115
8
2
8
0 221
8
2
8
0 646
8
2
8
0 597
8
2
8
0 1028
8
2
8
0 47
8
2
8
0 1466
8
2
8
0 1560
8
2
8
0 1131
8
2
8
0 750
8
2
8
0 344
8
2
8
0 1717
8
2
8
0 1671
8
2
8
0 1673
8
2
8
0 340
8
2
8
0 1037
8
2
8
0 683
8
2
8
0 565
8
2
8
0 858
8
2
8
0 1935
8
2...

result:

ok 

Test #67:

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

input:

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

output:

8
0 119
8
2
8
0 1841
8
2
8
0 420
8
2
8
0 1733
8
2
8
0 875
8
2
8
0 1896
8
2
8
0 647
8
2
8
0 241
8
2
8
0 1112
8
2
8
0 312
8
2
8
0 1467
8
2
8
0 1561
8
2
8
0 1384
8
2
8
0 751
8
2
8
0 345
8
2
8
0 221
8
2
8
0 1430
8
2
8
0 711
8
2
8
0 341
8
2
8
0 328
8
2
8
0 222
8
2
8
0 13
8
2
8
0 859
8
2
8
0 366
8
2
8
0 1...

result:

ok 

Test #68:

score: 45
Acceptable Answer
time: 18ms
memory: 3968kb

input:

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

output:

8
0 119
8
2
8
0 1841
8
2
8
0 420
8
2
8
0 1733
8
2
8
0 875
8
2
8
0 1896
8
2
8
0 647
8
2
8
0 241
8
2
8
0 1112
8
2
8
0 312
8
2
8
0 1467
8
2
8
0 1561
8
2
8
0 1384
8
2
8
1 1384
8
0 751
8
2
8
0 345
8
2
8
1 345
8
0 221
8
2
8
0 1430
8
2
8
0 711
8
2
8
0 341
8
2
8
0 328
8
2
8
0 222
8
2
8
0 13
8
2
8
0 859
8
2
...

result:

points 0.60 points  0.60

Test #69:

score: 45
Acceptable Answer
time: 31ms
memory: 3784kb

input:

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

output:

8
0 530
8
2
8
0 1098
8
2
8
0 1044
8
2
8
0 267
8
2
8
0 1120
8
2
8
1 1120
8
0 124
8
2
8
0 1511
8
2
8
1 1511
8
0 1214
8
2
8
0 1228
8
2
8
0 612
8
2
8
0 223
8
2
8
0 676
8
2
8
0 1157
8
2
8
1 1157
8
0 252
8
2
8
0 1472
8
2
8
0 1038
8
2
8
0 809
8
2
8
0 361
8
2
8
0 1910
8
2
8
1 1910
8
0 1913
8
2
8
0 1732
8
2
...

result:

points 0.60 points  0.60

Test #70:

score: 37.5
Acceptable Answer
time: 16ms
memory: 4096kb

input:

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

output:

8
0 530
8
2
8
0 1098
8
2
8
0 1044
8
2
8
0 267
8
2
8
0 1120
8
2
8
0 124
8
2
8
1 124
8
0 1511
8
2
8
0 1214
8
2
8
1 1214
8
0 1228
8
2
8
0 612
8
2
8
1 612
8
0 223
8
2
8
0 676
8
2
8
0 1157
8
2
8
0 252
8
2
8
1 252
8
0 1472
8
2
8
0 1038
8
2
8
0 809
8
2
8
1 809
8
0 361
8
2
8
0 1910
8
2
8
1 1910
8
0 1913
8
2...

result:

points 0.50 points  0.50

Test #71:

score: 37.5
Acceptable Answer
time: 26ms
memory: 3844kb

input:

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

output:

8
0 1948
8
2
8
0 1186
8
2
8
0 575
8
2
8
0 1794
8
2
8
0 52
8
2
8
0 1126
8
2
8
1 1126
8
0 446
8
2
8
0 1590
8
2
8
1 1590
8
0 1679
8
2
8
1 1679
8
0 845
8
2
8
0 1588
8
2
8
0 1922
8
2
8
1 1922
8
0 1455
8
2
8
0 385
8
2
8
0 1930
8
2
8
1 1930
8
0 1841
8
2
8
0 639
8
2
8
0 887
8
2
8
0 974
8
2
8
1 974
8
0 1774
...

result:

points 0.50 points  0.50

Test #72:

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

input:

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

output:

8
0 1948
8
2
8
0 1186
8
2
8
0 575
8
2
8
0 1794
8
2
8
0 52
8
2
8
0 1126
8
2
8
0 446
8
2
8
0 1590
8
2
8
0 1679
8
2
8
0 845
8
2
8
0 1588
8
2
8
0 1922
8
2
8
0 1455
8
2
8
0 385
8
2
8
0 1930
8
2
8
0 1841
8
2
8
0 639
8
2
8
0 887
8
2
8
0 974
8
2
8
0 1774
8
2
8
0 1624
8
2
8
1 1624
8
0 550
8
2
8
1 550
8
0 300...

result:

points 0.76053333330 points  0.76053333330

Test #73:

score: 57.04
Acceptable Answer
time: 16ms
memory: 3832kb

input:

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

output:

8
0 574
8
2
8
0 503
8
2
8
0 267
8
2
8
0 730
8
2
8
0 1089
8
2
8
0 369
8
2
8
0 722
8
2
8
0 818
8
2
8
0 1263
8
2
8
0 1511
8
2
8
0 989
8
2
8
0 688
8
2
8
1 688
8
0 197
8
2
8
0 1591
8
2
8
1 1591
8
0 1205
8
2
8
0 377
8
2
8
0 1336
8
2
8
0 1077
8
2
8
0 151
8
2
8
0 997
8
2
8
0 306
8
2
8
0 797
8
2
8
0 1332
8
2...

result:

points 0.76053333330 points  0.76053333330

Test #74:

score: 64.36
Acceptable Answer
time: 8ms
memory: 3820kb

input:

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

output:

8
0 574
8
2
8
0 503
8
2
8
0 267
8
2
8
0 730
8
2
8
0 1089
8
2
8
0 369
8
2
8
0 722
8
2
8
0 818
8
2
8
0 1263
8
2
8
0 1511
8
2
8
0 989
8
2
8
0 688
8
2
8
0 197
8
2
8
0 1591
8
2
8
0 1205
8
2
8
1 1205
8
0 377
8
2
8
0 1336
8
2
8
0 1077
8
2
8
0 151
8
2
8
1 151
8
0 997
8
2
8
0 306
8
2
8
0 797
8
2
8
0 1332
8
2...

result:

points 0.85813333330 points  0.85813333330

Test #75:

score: 64.36
Acceptable Answer
time: 6ms
memory: 4124kb

input:

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

output:

8
0 574
8
2
8
0 503
8
2
8
0 267
8
2
8
0 730
8
2
8
0 1089
8
2
8
0 369
8
2
8
0 722
8
2
8
0 818
8
2
8
0 1263
8
2
8
0 1511
8
2
8
0 989
8
2
8
0 688
8
2
8
0 197
8
2
8
0 1591
8
2
8
0 1205
8
2
8
1 1205
8
0 377
8
2
8
0 1336
8
2
8
0 1077
8
2
8
0 151
8
2
8
1 151
8
0 997
8
2
8
0 306
8
2
8
0 797
8
2
8
0 1332
8
2...

result:

points 0.85813333330 points  0.85813333330

Test #76:

score: 45
Acceptable Answer
time: 10ms
memory: 4076kb

input:

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

output:

8
0 124
8
2
8
0 948
8
2
8
0 817
8
2
8
0 1335
8
2
8
0 1464
8
2
8
0 1107
8
2
8
1 1107
8
0 1022
8
2
8
0 1267
8
2
8
0 285
8
2
8
0 544
8
2
8
0 1796
8
2
8
0 986
8
2
8
0 799
8
2
8
0 1242
8
2
8
0 1734
8
2
8
1 1734
8
0 284
8
2
8
0 229
8
2
8
1 229
8
0 1545
8
2
8
0 945
8
2
8
0 1836
8
2
8
0 377
8
2
8
0 1920
8
2...

result:

points 0.60 points  0.60

Test #77:

score: 45
Acceptable Answer
time: 21ms
memory: 3820kb

input:

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

output:

8
0 124
8
2
8
0 948
8
2
8
0 817
8
2
8
0 1335
8
2
8
0 1464
8
2
8
0 1107
8
2
8
0 1022
8
2
8
0 1267
8
2
8
0 285
8
2
8
0 544
8
2
8
0 1796
8
2
8
0 986
8
2
8
1 986
8
0 799
8
2
8
0 1242
8
2
8
0 1734
8
2
8
0 284
8
2
8
0 229
8
2
8
1 229
8
0 1545
8
2
8
0 945
8
2
8
1 945
8
0 1836
8
2
8
0 377
8
2
8
0 1920
8
2
8...

result:

points 0.60 points  0.60

Test #78:

score: 57.03
Acceptable Answer
time: 5ms
memory: 3820kb

input:

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

output:

8
0 1965
8
2
8
0 1618
8
2
8
0 1168
8
2
8
0 1544
8
2
8
0 1664
8
2
8
0 1841
8
2
8
1 1841
8
0 1903
8
2
8
0 185
8
2
8
0 1222
8
2
8
0 620
8
2
8
0 1257
8
2
8
1 1257
8
0 1376
8
2
8
0 1283
8
2
8
0 84
8
2
8
1 84
8
0 1814
8
2
8
1 1814
8
0 186
8
2
8
0 1886
8
2
8
0 1028
8
2
8
1 1028
8
0 245
8
2
8
1 245
8
0 1536...

result:

points 0.76040 points  0.76040

Test #79:

score: 57.03
Acceptable Answer
time: 9ms
memory: 3892kb

input:

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

output:

8
0 1965
8
2
8
0 1618
8
2
8
0 1168
8
2
8
0 1544
8
2
8
0 1664
8
2
8
0 1841
8
2
8
1 1841
8
0 1903
8
2
8
0 185
8
2
8
0 1222
8
2
8
0 620
8
2
8
0 1257
8
2
8
0 1376
8
2
8
0 1283
8
2
8
0 84
8
2
8
1 84
8
0 1814
8
2
8
1 1814
8
0 186
8
2
8
0 1886
8
2
8
0 1028
8
2
8
1 1028
8
0 245
8
2
8
1 245
8
0 1536
8
2
8
0 ...

result:

points 0.76040 points  0.76040

Test #80:

score: 57
Acceptable Answer
time: 5ms
memory: 3828kb

input:

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

output:

8
0 1965
8
2
8
0 1618
8
2
8
0 1168
8
2
8
0 1544
8
2
8
0 1664
8
2
8
0 1841
8
2
8
0 1903
8
2
8
0 185
8
2
8
0 1222
8
2
8
0 620
8
2
8
0 1257
8
2
8
0 1376
8
2
8
0 1283
8
2
8
0 84
8
2
8
0 1814
8
2
8
0 186
8
2
8
0 1886
8
2
8
0 1028
8
2
8
0 245
8
2
8
0 1536
8
2
8
0 1111
8
2
8
0 687
8
2
8
0 1185
8
2
8
1 1185...

result:

points 0.760 points  0.760

Test #81:

score: 57
Acceptable Answer
time: 30ms
memory: 3896kb

input:

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

output:

8
0 1954
8
2
8
0 261
8
2
8
0 271
8
2
8
0 422
8
2
8
0 1862
8
2
8
0 826
8
2
8
0 1897
8
2
8
0 1147
8
2
8
0 165
8
2
8
0 1116
8
2
8
0 770
8
2
8
0 683
8
2
8
0 1055
8
2
8
0 348
8
2
8
0 1726
8
2
8
0 1085
8
2
8
0 1201
8
2
8
0 1788
8
2
8
0 1495
8
2
8
0 87
8
2
8
0 1569
8
2
8
1 1569
8
0 450
8
2
8
0 938
8
2
8
1 ...

result:

points 0.760 points  0.760

Test #82:

score: 45
Acceptable Answer
time: 23ms
memory: 3828kb

input:

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

output:

8
0 1954
8
2
8
0 261
8
2
8
0 271
8
2
8
0 422
8
2
8
0 1862
8
2
8
0 826
8
2
8
0 1897
8
2
8
0 1147
8
2
8
0 165
8
2
8
0 1116
8
2
8
0 770
8
2
8
0 683
8
2
8
0 1055
8
2
8
0 348
8
2
8
1 348
8
0 1726
8
2
8
1 1726
8
0 1085
8
2
8
0 1201
8
2
8
0 1788
8
2
8
0 1495
8
2
8
0 87
8
2
8
0 1569
8
2
8
0 450
8
2
8
0 938
...

result:

points 0.60 points  0.60

Test #83:

score: 45
Acceptable Answer
time: 18ms
memory: 3820kb

input:

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

output:

8
0 719
8
2
8
0 108
8
2
8
0 193
8
2
8
0 249
8
2
8
0 1226
8
2
8
0 46
8
2
8
0 920
8
2
8
1 920
8
0 322
8
2
8
0 1441
8
2
8
0 8
8
2
8
1 8
8
0 416
8
2
8
0 227
8
2
8
0 175
8
2
8
0 1864
8
2
8
1 1864
8
0 519
8
2
8
0 216
8
2
8
0 1385
8
2
8
0 1514
8
2
8
0 737
8
2
8
0 1139
8
2
8
0 84
8
2
8
0 1670
8
2
8
1 1670
8...

result:

points 0.60 points  0.60

Test #84:

score: 49.47
Acceptable Answer
time: 7ms
memory: 3836kb

input:

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

output:

8
0 511
8
2
8
0 108
8
2
8
1 108
8
0 193
8
2
8
0 249
8
2
8
1 249
8
0 37
8
2
8
0 46
8
2
8
0 255
8
2
8
1 255
8
0 322
8
2
8
1 322
8
0 164
8
2
8
1 164
8
0 8
8
2
8
1 8
8
0 416
8
2
8
1 416
8
0 227
8
2
8
1 227
8
0 175
8
2
8
1 175
8
0 111
8
2
8
1 111
8
0 519
8
2
8
1 519
8
0 216
8
2
8
1 216
8
0 530
8
2
8
1 53...

result:

points 0.65960 points  0.65960

Test #85:

score: 34.98
Acceptable Answer
time: 5ms
memory: 3780kb

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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 719
8
2
8
0 108
8
2
8
1 108
8
0 193
8
2
8
0 249
8
2
8
1 249
8
0 1226
8
2
8
1 1226
8
0 46
8
2
8
1 46
8
0 920
8
2
8
1 920
8
0 322
8
2
8
1 322
8
0 1441
8
2
8
1 1441
8
0 8
8
2
8
1 8
8
0 416
8
2
8
1 416
8
0 227
8
2
8
1 227
8
0 175
8
2
8
1 175
8
0 1408
8
2
8
1 1408
8
0 519
8
2
8
1 519
8
0 216
8
2
8
1 ...

result:

points 0.46640 points  0.46640

Test #86:

score: 25
Acceptable Answer
time: 13ms
memory: 3828kb

input:

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

output:

8
0 561
8
2
8
0 538
8
2
8
1 538
8
0 1013
8
2
8
1 1013
8
0 1462
8
2
8
0 1465
8
2
8
1 1465
8
0 494
8
2
8
1 494
8
0 688
8
2
8
1 688
8
0 790
8
2
8
1 790
8
0 256
8
2
8
1 256
8
0 1112
8
2
8
1 1112
8
0 797
8
2
8
1 797
8
0 1574
8
2
8
1 1574
8
0 1797
8
2
8
1 1797
8
0 1531
8
2
8
1 1531
8
0 1661
8
2
8
1 1661
8...

result:

points 0.33333333330 points  0.33333333330

Test #87:

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

input:

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

output:

8
0 385
8
2
8
0 955
8
2
8
1 955
8
0 1946
8
2
8
0 813
8
2
8
1 813
8
0 1969
8
2
8
0 533
8
2
8
1 533
8
0 291
8
2
8
1 291
8
0 1158
8
2
8
0 753
8
2
8
1 753
8
0 1564
8
2
8
0 1314
8
2
8
0 1182
8
2
8
0 251
8
2
8
1 251
8
0 508
8
2
8
1 508
8
0 992
8
2
8
1 992
8
0 617
8
2
8
1 617
8
0 1230
8
2
8
0 459
8
2
8
1 4...

result:

ok 

Test #88:

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

input:

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

output:

8
0 385
8
2
8
0 955
8
2
8
0 1946
8
2
8
0 813
8
2
8
0 1969
8
2
8
1 1969
8
0 533
8
2
8
0 291
8
2
8
0 1158
8
2
8
1 1158
8
0 753
8
2
8
0 1564
8
2
8
1 1564
8
0 1314
8
2
8
1 1314
8
0 1182
8
2
8
1 1182
8
0 251
8
2
8
0 508
8
2
8
0 992
8
2
8
0 617
8
2
8
0 1230
8
2
8
1 1230
8
0 459
8
2
8
0 307
8
2
8
0 817
8
2...

result:

ok 

Test #89:

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

input:

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

output:

8
0 385
8
2
8
0 955
8
2
8
0 1946
8
2
8
1 1946
8
0 813
8
2
8
0 1969
8
2
8
1 1969
8
0 533
8
2
8
0 291
8
2
8
1 291
8
0 1158
8
2
8
0 753
8
2
8
0 1564
8
2
8
1 1564
8
0 1314
8
2
8
0 1182
8
2
8
0 251
8
2
8
1 251
8
0 508
8
2
8
0 992
8
2
8
0 617
8
2
8
0 1230
8
2
8
0 459
8
2
8
1 459
8
0 307
8
2
8
1 307
8
0 81...

result:

ok