QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#140402#4565. Rarest Insectssomethingnew#69.5 41ms4108kbC++204.1kb2023-08-15 21:04:042024-07-04 01:44:50

Judging History

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

  • [2024-07-04 01:44:50]
  • 评测
  • 测评结果:69.5
  • 用时:41ms
  • 内存:4108kb
  • [2023-08-15 21:04:04]
  • 提交

answer

//  ↘ ⬇ ⬇ ⬇ ⬇ ⬇ ↙
//  ➡ @roadfromroi ⬅
//  ↗ ⬆ ⬆ ⬆ ⬆ ⬆ ↖
#include <iostream>
#include "vector"
#include "algorithm"
#include "numeric"
#include "climits"
#include "iomanip"
#include "bitset"
#include "cmath"
#include "map"
#include "deque"
#include "array"
#include "set"
#include "random"
#define all(x) x.begin(), x.end()
using namespace std;
#include "insects.h"
mt19937 rnd;
int min_cardinality(int N) {
    vector<int> iba(N);
    for (int i = 0; i < N; ++i) {
        iba[i] = i;
    }
    vector<int> ex(N, 1);
    for (int i = 0; i < N; ++i) {
        swap(iba[i], iba[rnd() % N]);
    }
    for (int i = 0; i < N; ++i) {
        swap(iba[i], iba[rnd() % N]);
    }
    for (int i = 0; i < N; ++i) {
        swap(iba[i], iba[rnd() % N]);
    }
    for (int i = 0; i < N; ++i) {
        swap(iba[i], iba[rnd() % N]);
    }
    int cnt = 0;
    int gcnt = 0;
    int prvl = 2;
    int lstch = 0;
    for (int i = 0; i < N; ++i) {
        move_inside(iba[i]);
        if (press_button() == 2) {
            move_outside(iba[i]);
        } else {
            cnt++;
            lstch = i;
            //cerr << "ADD " << i << ' ' << press_button() << endl;
            ex[i] = 0;
        }
    }
    gcnt = cnt;
    for (int i = (lstch + 1) % N; i != lstch; i = (i + 1) % N) {
        //cerr << i << endl;
        if (ex[i]) {
            //cerr << i << endl;
            move_inside(iba[i]);
            if (prvl != press_button()) {
                move_outside(iba[i]);
            } else {
                ex[i] = 0;
                cnt--;
                lstch = i;
                if (cnt == 0) {
                    cnt = gcnt;
                    prvl++;
                }
            }
        }
    }
    return prvl - 1;
}
#ifdef __APPLE__

static inline constexpr int kMaxQueries = 40000;

static int N;
// Insect types are compressed to colors in the range [0, N).
static std::vector<int> color;
static std::vector<bool> in_box;

static std::vector<int> color_occurrences;
static std::multiset<int> max_occurrences;

static std::vector<int> op_counter(3, 0);

static inline void protocol_violation(std::string message) {
    printf("Protocol Violation: %s\n", message.c_str());
    exit(0);
}

void move_inside(int i) {
    if (i < 0 || i >= N) {
        protocol_violation("invalid parameter");
    }
    ++op_counter[0];
    if (op_counter[0] > kMaxQueries) {
        protocol_violation("too many calls");
    }
    if (!in_box[i]) {
        in_box[i] = true;
        max_occurrences.erase(max_occurrences.find(color_occurrences[color[i]]));
        ++color_occurrences[color[i]];
        max_occurrences.insert(color_occurrences[color[i]]);
    }
}

void move_outside(int i) {
    if (i < 0 || i >= N) {
        protocol_violation("invalid parameter");
    }
    ++op_counter[1];
    if (op_counter[1] > kMaxQueries) {
        protocol_violation("too many calls");
    }
    if (in_box[i]) {
        in_box[i] = false;
        max_occurrences.erase(max_occurrences.find(color_occurrences[color[i]]));
        --color_occurrences[color[i]];
        max_occurrences.insert(color_occurrences[color[i]]);
    }
}

int press_button() {
    ++op_counter[2];
    if (op_counter[2] > kMaxQueries) {
        protocol_violation("too many calls");
    }
    return *(max_occurrences.rbegin());
}

int main() {
    N=2000;//assert(1 == scanf("%d", &N));
    color.resize(N);
    in_box.assign(N, false);

    std::map<int, int> type_to_color;
    for (int i = 0; i < N; ++i) {
        int Ti;
        Ti = i % 100 + 1;
        //assert(1 == scanf("%d", &Ti));
        if (type_to_color.find(Ti) == type_to_color.end()) {
            int new_color = type_to_color.size();
            type_to_color[Ti] = new_color;
            max_occurrences.insert(0);
        }
        color[i] = type_to_color[Ti];
    }

    color_occurrences.assign(type_to_color.size(), 0);

    int answer = min_cardinality(N);
    int Q = *std::max_element(op_counter.begin(), op_counter.end());
    printf("%d\n", answer);
    printf("%d\n", Q);
    return 0;
}
#endif

详细

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

6
1
1
1
2
2
2
2
2
3

output:

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

result:

ok 

Test #2:

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

input:

2
1
2
2

output:

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

result:

ok 

Test #3:

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

input:

2
1
1

output:

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

result:

ok 

Test #4:

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

input:

3
1
1
2
2

output:

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

result:

ok 

Test #5:

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

input:

5
1
1
2
2
2
2
3
2
3

output:

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

result:

ok 

Test #6:

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

input:

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

output:

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

result:

ok 

Test #7:

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

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 198
8
2
8
0 92
8
2
8
1 92
8
0 83
8
2
8
1 83
8
0 24
8
2
8
1 24
8
0 94
8
2
8
1 94
8
0 96
8
2
8
1 96
8
0 10
8
2
8
1 10
8
0 57
8
2
8
1 57
8
0 167
8
2
8
1 167
8
0 163
8
2
8
1 163
8
0 169
8
2
8
1 169
8
0 188
8
2
8
1 188
8
0 46
8
2
8
1 46
8
0 7
8
2
8
1 7
8
0 79
8
2
8
1 79
8
0 114
8
2
8
1 114
8
0 117
8
...

result:

ok 

Test #8:

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

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 124
8
2
8
0 12
8
2
8
0 52
8
2
8
0 38
8
2
8
0 163
8
2
8
0 129
8
2
8
0 61
8
2
8
0 71
8
2
8
0 56
8
2
8
0 154
8
2
8
0 159
8
2
8
0 96
8
2
8
0 190
8
2
8
0 130
8
2
8
0 33
8
2
8
0 76
8
2
8
0 2
8
2
8
0 44
8
2
8
0 22
8
2
8
0 79
8
2
8
0 161
8
2
8
0 3
8
2
8
0 178
8
2
8
0 165
8
2
8
0 169
8
2
8
0 155
8
2
8
0 ...

result:

ok 

Test #9:

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

input:

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

output:

8
0 124
8
2
8
0 12
8
2
8
0 52
8
2
8
1 52
8
0 38
8
2
8
1 38
8
0 163
8
2
8
0 129
8
2
8
0 61
8
2
8
0 71
8
2
8
0 56
8
2
8
0 154
8
2
8
1 154
8
0 159
8
2
8
1 159
8
0 96
8
2
8
0 190
8
2
8
1 190
8
0 130
8
2
8
1 130
8
0 33
8
2
8
0 76
8
2
8
1 76
8
0 2
8
2
8
1 2
8
0 44
8
2
8
1 44
8
0 22
8
2
8
0 79
8
2
8
1 79
8...

result:

ok 

Test #10:

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

input:

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

output:

8
0 170
8
2
8
0 24
8
2
8
0 145
8
2
8
0 29
8
2
8
0 99
8
2
8
0 49
8
2
8
0 69
8
2
8
0 53
8
2
8
0 118
8
2
8
0 61
8
2
8
1 61
8
0 128
8
2
8
0 130
8
2
8
1 130
8
0 104
8
2
8
1 104
8
0 28
8
2
8
1 28
8
0 109
8
2
8
0 89
8
2
8
1 89
8
0 193
8
2
8
1 193
8
0 169
8
2
8
1 169
8
0 158
8
2
8
1 158
8
0 129
8
2
8
1 129
...

result:

ok 

Test #11:

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

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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 198
8
2
8
0 92
8
2
8
1 92
8
0 83
8
2
8
1 83
8
0 24
8
2
8
1 24
8
0 94
8
2
8
1 94
8
0 96
8
2
8
1 96
8
0 10
8
2
8
1 10
8
0 57
8
2
8
1 57
8
0 167
8
2
8
1 167
8
0 163
8
2
8
1 163
8
0 169
8
2
8
1 169
8
0 188
8
2
8
1 188
8
0 46
8
2
8
1 46
8
0 7
8
2
8
1 7
8
0 79
8
2
8
1 79
8
0 114
8
2
8
1 114
8
0 117
8
...

result:

ok 

Test #12:

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

input:

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

output:

8
0 86
8
2
8
0 107
8
2
8
0 184
8
2
8
0 45
8
2
8
0 113
8
2
8
1 113
8
0 116
8
2
8
0 152
8
2
8
1 152
8
0 131
8
2
8
1 131
8
0 187
8
2
8
1 187
8
0 91
8
2
8
1 91
8
0 78
8
2
8
1 78
8
0 118
8
2
8
0 181
8
2
8
1 181
8
0 97
8
2
8
1 97
8
0 115
8
2
8
1 115
8
0 36
8
2
8
0 127
8
2
8
0 169
8
2
8
1 169
8
0 114
8
2
8...

result:

ok 

Test #13:

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

input:

197
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 86
8
2
8
0 107
8
2
8
0 184
8
2
8
0 45
8
2
8
0 113
8
2
8
1 113
8
0 116
8
2
8
1 116
8
0 152
8
2
8
1 152
8
0 131
8
2
8
1 131
8
0 187
8
2
8
1 187
8
0 91
8
2
8
1 91
8
0 78
8
2
8
1 78
8
0 118
8
2
8
1 118
8
0 181
8
2
8
1 181
8
0 97
8
2
8
1 97
8
0 115
8
2
8
1 115
8
0 36
8
2
8
1 36
8
0 127
8
2
8
1 127
8
...

result:

ok 

Test #14:

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

input:

198
1
1
1
1
1
2
2
1
1
1
2
2
1
1
2
2
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 170
8
2
8
0 24
8
2
8
0 145
8
2
8
0 29
8
2
8
0 99
8
2
8
0 49
8
2
8
1 49
8
0 69
8
2
8
1 69
8
0 53
8
2
8
0 118
8
2
8
0 61
8
2
8
0 128
8
2
8
1 128
8
0 130
8
2
8
1 130
8
0 104
8
2
8
0 28
8
2
8
0 109
8
2
8
1 109
8
0 89
8
2
8
1 89
8
0 193
8
2
8
1 193
8
0 169
8
2
8
0 158
8
2
8
1 158
8
0 129
8
2
8
1 129
...

result:

ok 

Test #15:

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

input:

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

output:

8
0 124
8
2
8
0 12
8
2
8
0 52
8
2
8
0 38
8
2
8
1 38
8
0 163
8
2
8
0 129
8
2
8
1 129
8
0 61
8
2
8
1 61
8
0 71
8
2
8
1 71
8
0 56
8
2
8
1 56
8
0 154
8
2
8
1 154
8
0 159
8
2
8
1 159
8
0 96
8
2
8
1 96
8
0 190
8
2
8
1 190
8
0 130
8
2
8
1 130
8
0 33
8
2
8
1 33
8
0 76
8
2
8
1 76
8
0 2
8
2
8
1 2
8
0 44
8
2
8...

result:

ok 

Test #16:

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

input:

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

output:

8
0 193
8
2
8
0 12
8
2
8
1 12
8
0 86
8
2
8
0 11
8
2
8
0 87
8
2
8
1 87
8
0 125
8
2
8
0 52
8
2
8
0 115
8
2
8
1 115
8
0 194
8
2
8
0 39
8
2
8
1 39
8
0 154
8
2
8
0 99
8
2
8
1 99
8
0 123
8
2
8
1 123
8
0 136
8
2
8
1 136
8
0 97
8
2
8
1 97
8
0 191
8
2
8
0 40
8
2
8
1 40
8
0 108
8
2
8
1 108
8
0 149
8
2
8
1 149...

result:

ok 

Test #17:

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

input:

199
1
1
1
1
2
2
1
2
1
2
2
1
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 198
8
2
8
0 92
8
2
8
0 83
8
2
8
0 24
8
2
8
0 94
8
2
8
1 94
8
0 96
8
2
8
1 96
8
0 10
8
2
8
0 57
8
2
8
1 57
8
0 167
8
2
8
0 163
8
2
8
1 163
8
0 169
8
2
8
1 169
8
0 188
8
2
8
0 46
8
2
8
1 46
8
0 7
8
2
8
1 7
8
0 79
8
2
8
1 79
8
0 114
8
2
8
0 117
8
2
8
1 117
8
0 13
8
2
8
1 13
8
0 108
8
2
8
1 108
8
0 ...

result:

ok 

Test #18:

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

input:

196
1
1
1
2
1
2
2
1
1
2
2
1
1
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 193
8
2
8
0 12
8
2
8
0 86
8
2
8
0 11
8
2
8
1 11
8
0 87
8
2
8
0 125
8
2
8
1 125
8
0 52
8
2
8
1 52
8
0 115
8
2
8
0 194
8
2
8
0 39
8
2
8
1 39
8
0 154
8
2
8
1 154
8
0 99
8
2
8
0 123
8
2
8
0 136
8
2
8
1 136
8
0 97
8
2
8
1 97
8
0 191
8
2
8
1 191
8
0 40
8
2
8
1 40
8
0 108
8
2
8
0 149
8
2
8
0 33
8
2
8
1...

result:

ok 

Test #19:

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

input:

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

output:

8
0 193
8
2
8
0 12
8
2
8
0 86
8
2
8
0 11
8
2
8
0 87
8
2
8
0 125
8
2
8
0 52
8
2
8
1 52
8
0 115
8
2
8
1 115
8
0 194
8
2
8
1 194
8
0 39
8
2
8
0 154
8
2
8
0 99
8
2
8
0 123
8
2
8
0 136
8
2
8
1 136
8
0 97
8
2
8
0 191
8
2
8
1 191
8
0 40
8
2
8
1 40
8
0 108
8
2
8
1 108
8
0 149
8
2
8
0 33
8
2
8
1 33
8
0 91
8
...

result:

ok 

Test #20:

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

input:

196
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 193
8
2
8
0 12
8
2
8
0 86
8
2
8
0 11
8
2
8
1 11
8
0 87
8
2
8
0 125
8
2
8
0 52
8
2
8
0 115
8
2
8
0 194
8
2
8
0 39
8
2
8
0 154
8
2
8
0 99
8
2
8
0 123
8
2
8
1 123
8
0 136
8
2
8
0 97
8
2
8
0 191
8
2
8
0 40
8
2
8
1 40
8
0 108
8
2
8
1 108
8
0 149
8
2
8
1 149
8
0 33
8
2
8
1 33
8
0 91
8
2
8
0 28
8
2
8
1...

result:

ok 

Test #21:

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

input:

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

output:

8
0 124
8
2
8
0 12
8
2
8
0 52
8
2
8
0 38
8
2
8
0 163
8
2
8
0 129
8
2
8
0 61
8
2
8
0 71
8
2
8
0 56
8
2
8
1 56
8
0 154
8
2
8
0 159
8
2
8
0 96
8
2
8
0 190
8
2
8
0 130
8
2
8
0 33
8
2
8
1 33
8
0 76
8
2
8
0 2
8
2
8
0 44
8
2
8
0 22
8
2
8
0 79
8
2
8
0 161
8
2
8
0 3
8
2
8
1 3
8
0 178
8
2
8
0 165
8
2
8
0 169
...

result:

ok 

Test #22:

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

input:

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

output:

8
0 198
8
2
8
0 92
8
2
8
0 83
8
2
8
0 24
8
2
8
0 94
8
2
8
0 96
8
2
8
0 10
8
2
8
0 57
8
2
8
0 167
8
2
8
0 163
8
2
8
0 169
8
2
8
0 188
8
2
8
0 46
8
2
8
0 7
8
2
8
1 7
8
0 79
8
2
8
1 79
8
0 114
8
2
8
0 117
8
2
8
0 13
8
2
8
0 108
8
2
8
0 196
8
2
8
0 40
8
2
8
0 142
8
2
8
0 2
8
2
8
0 153
8
2
8
0 121
8
2
8
...

result:

ok 

Test #23:

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

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

output:

8
0 170
8
2
8
0 24
8
2
8
0 145
8
2
8
0 29
8
2
8
0 99
8
2
8
0 49
8
2
8
0 69
8
2
8
0 53
8
2
8
0 118
8
2
8
0 61
8
2
8
0 128
8
2
8
0 130
8
2
8
0 104
8
2
8
0 28
8
2
8
0 109
8
2
8
0 89
8
2
8
0 193
8
2
8
0 169
8
2
8
0 158
8
2
8
0 129
8
2
8
0 123
8
2
8
0 78
8
2
8
0 72
8
2
8
0 12
8
2
8
0 126
8
2
8
1 126
8
0 ...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

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

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 779
8
2
8
0 202
8
2
8
1 202
8
0 981
8
2
8
1 981
8
0 298
8
2
8
1 298
8
0 70
8
2
8
1 70
8
0 4
8
2
8
1 4
8
0 679
8
2
8
1 679
8
0 81
8
2
8
1 81
8
0 810
8
2
8
1 810
8
0 393
8
2
8
1 393
8
0 613
8
2
8
1 613
8
0 559
8
2
8
1 559
8
0 670
8
2
8
1 670
8
0 410
8
2
8
1 410
8
0 873
8
2
8
1 873
8
0 176
8
2
8
1 ...

result:

ok 

Test #25:

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

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 779
8
2
8
0 202
8
2
8
0 981
8
2
8
0 298
8
2
8
0 70
8
2
8
0 4
8
2
8
0 679
8
2
8
0 81
8
2
8
0 810
8
2
8
0 393
8
2
8
0 613
8
2
8
0 559
8
2
8
0 670
8
2
8
0 410
8
2
8
0 873
8
2
8
0 176
8
2
8
0 204
8
2
8
0 201
8
2
8
0 477
8
2
8
0 593
8
2
8
0 158
8
2
8
0 74
8
2
8
0 905
8
2
8
0 434
8
2
8
0 223
8
2
8
0 7...

result:

ok 

Test #26:

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

input:

999
1
1
1
1
2
1
2
1
1
1
2
1
1
1
1
2
1
1
1
2
2
1
2
2
2
1
2
2
1
1
2
2
2
2
2
2
2
1
2
2
2
2
2
1
2
1
2
2
2
2
1
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
1
1
2
1
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 820
8
2
8
0 858
8
2
8
0 268
8
2
8
0 43
8
2
8
0 40
8
2
8
1 40
8
0 56
8
2
8
0 320
8
2
8
1 320
8
0 984
8
2
8
0 317
8
2
8
0 936
8
2
8
0 389
8
2
8
1 389
8
0 406
8
2
8
0 923
8
2
8
0 65
8
2
8
0 574
8
2
8
0 158
8
2
8
1 158
8
0 810
8
2
8
0 453
8
2
8
0 92
8
2
8
0 294
8
2
8
1 294
8
0 271
8
2
8
1 271
8
0 37...

result:

ok 

Test #27:

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

input:

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

output:

8
0 820
8
2
8
0 858
8
2
8
0 268
8
2
8
0 43
8
2
8
0 40
8
2
8
0 56
8
2
8
0 320
8
2
8
0 984
8
2
8
0 317
8
2
8
0 936
8
2
8
0 389
8
2
8
0 406
8
2
8
1 406
8
0 923
8
2
8
0 65
8
2
8
0 574
8
2
8
1 574
8
0 158
8
2
8
1 158
8
0 810
8
2
8
1 810
8
0 453
8
2
8
0 92
8
2
8
0 294
8
2
8
1 294
8
0 271
8
2
8
1 271
8
0 3...

result:

ok 

Test #28:

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

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 179
8
2
8
0 521
8
2
8
1 521
8
0 920
8
2
8
1 920
8
0 523
8
2
8
1 523
8
0 318
8
2
8
1 318
8
0 507
8
2
8
1 507
8
0 812
8
2
8
1 812
8
0 183
8
2
8
1 183
8
0 860
8
2
8
1 860
8
0 42
8
2
8
1 42
8
0 376
8
2
8
1 376
8
0 295
8
2
8
1 295
8
0 937
8
2
8
1 937
8
0 234
8
2
8
1 234
8
0 552
8
2
8
1 552
8
0 720
8
...

result:

ok 

Test #29:

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

input:

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

output:

8
0 628
8
2
8
0 972
8
2
8
0 209
8
2
8
0 362
8
2
8
1 362
8
0 739
8
2
8
1 739
8
0 225
8
2
8
1 225
8
0 842
8
2
8
1 842
8
0 575
8
2
8
0 689
8
2
8
0 287
8
2
8
0 983
8
2
8
1 983
8
0 188
8
2
8
0 113
8
2
8
0 137
8
2
8
0 915
8
2
8
1 915
8
0 684
8
2
8
1 684
8
0 14
8
2
8
0 380
8
2
8
1 380
8
0 204
8
2
8
0 804
8...

result:

ok 

Test #30:

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

input:

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

output:

8
0 686
8
2
8
0 738
8
2
8
0 228
8
2
8
1 228
8
0 86
8
2
8
1 86
8
0 441
8
2
8
0 600
8
2
8
1 600
8
0 809
8
2
8
1 809
8
0 712
8
2
8
1 712
8
0 49
8
2
8
1 49
8
0 582
8
2
8
1 582
8
0 886
8
2
8
1 886
8
0 742
8
2
8
1 742
8
0 250
8
2
8
1 250
8
0 974
8
2
8
1 974
8
0 829
8
2
8
1 829
8
0 787
8
2
8
1 787
8
0 927
...

result:

ok 

Test #31:

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

input:

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

output:

8
0 686
8
2
8
0 738
8
2
8
0 228
8
2
8
0 86
8
2
8
0 441
8
2
8
0 600
8
2
8
0 809
8
2
8
0 712
8
2
8
0 49
8
2
8
0 582
8
2
8
0 886
8
2
8
0 742
8
2
8
1 742
8
0 250
8
2
8
0 974
8
2
8
0 829
8
2
8
0 787
8
2
8
0 927
8
2
8
0 826
8
2
8
0 274
8
2
8
1 274
8
0 793
8
2
8
0 672
8
2
8
1 672
8
0 652
8
2
8
0 846
8
2
8
...

result:

ok 

Test #32:

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

input:

1000
1
1
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 779
8
2
8
0 202
8
2
8
0 981
8
2
8
0 298
8
2
8
0 70
8
2
8
1 70
8
0 4
8
2
8
0 679
8
2
8
1 679
8
0 81
8
2
8
1 81
8
0 810
8
2
8
1 810
8
0 393
8
2
8
1 393
8
0 613
8
2
8
1 613
8
0 559
8
2
8
1 559
8
0 670
8
2
8
1 670
8
0 410
8
2
8
1 410
8
0 873
8
2
8
1 873
8
0 176
8
2
8
1 176
8
0 204
8
2
8
1 204
8
0 20...

result:

ok 

Test #33:

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

input:

996
1
1
2
1
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 179
8
2
8
0 521
8
2
8
0 920
8
2
8
1 920
8
0 523
8
2
8
0 318
8
2
8
1 318
8
0 507
8
2
8
0 812
8
2
8
0 183
8
2
8
0 860
8
2
8
1 860
8
0 42
8
2
8
0 376
8
2
8
1 376
8
0 295
8
2
8
1 295
8
0 937
8
2
8
1 937
8
0 234
8
2
8
1 234
8
0 552
8
2
8
1 552
8
0 720
8
2
8
1 720
8
0 56
8
2
8
0 154
8
2
8
1 154
8
0 42...

result:

ok 

Test #34:

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

input:

1000
1
1
1
1
2
2
2
1
1
2
2
2
2
2
1
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 779
8
2
8
0 202
8
2
8
0 981
8
2
8
0 298
8
2
8
0 70
8
2
8
1 70
8
0 4
8
2
8
1 4
8
0 679
8
2
8
1 679
8
0 81
8
2
8
0 810
8
2
8
0 393
8
2
8
1 393
8
0 613
8
2
8
1 613
8
0 559
8
2
8
1 559
8
0 670
8
2
8
1 670
8
0 410
8
2
8
1 410
8
0 873
8
2
8
0 176
8
2
8
1 176
8
0 204
8
2
8
0 201
8
2
8
1 201
8
0 477
8
2...

result:

ok 

Test #35:

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

input:

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

output:

8
0 779
8
2
8
0 202
8
2
8
0 981
8
2
8
0 298
8
2
8
0 70
8
2
8
1 70
8
0 4
8
2
8
0 679
8
2
8
1 679
8
0 81
8
2
8
0 810
8
2
8
1 810
8
0 393
8
2
8
1 393
8
0 613
8
2
8
0 559
8
2
8
1 559
8
0 670
8
2
8
0 410
8
2
8
1 410
8
0 873
8
2
8
1 873
8
0 176
8
2
8
1 176
8
0 204
8
2
8
0 201
8
2
8
1 201
8
0 477
8
2
8
1 4...

result:

ok 

Test #36:

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

input:

997
1
1
1
1
1
2
1
1
1
2
1
1
2
2
2
2
1
2
2
2
2
2
1
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 702
8
2
8
0 670
8
2
8
0 324
8
2
8
0 388
8
2
8
0 965
8
2
8
0 741
8
2
8
1 741
8
0 719
8
2
8
0 602
8
2
8
0 141
8
2
8
0 298
8
2
8
1 298
8
0 630
8
2
8
0 740
8
2
8
0 735
8
2
8
1 735
8
0 905
8
2
8
1 905
8
0 501
8
2
8
1 501
8
0 590
8
2
8
1 590
8
0 195
8
2
8
0 971
8
2
8
1 971
8
0 566
8
2
8
1 566
8
0 667
...

result:

ok 

Test #37:

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

input:

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

output:

8
0 628
8
2
8
0 972
8
2
8
0 209
8
2
8
0 362
8
2
8
0 739
8
2
8
0 225
8
2
8
1 225
8
0 842
8
2
8
0 575
8
2
8
0 689
8
2
8
0 287
8
2
8
1 287
8
0 983
8
2
8
0 188
8
2
8
0 113
8
2
8
0 137
8
2
8
1 137
8
0 915
8
2
8
0 684
8
2
8
1 684
8
0 14
8
2
8
1 14
8
0 380
8
2
8
1 380
8
0 204
8
2
8
1 204
8
0 804
8
2
8
1 80...

result:

ok 

Test #38:

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

input:

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

output:

8
0 702
8
2
8
0 670
8
2
8
0 324
8
2
8
0 388
8
2
8
0 965
8
2
8
1 965
8
0 741
8
2
8
1 741
8
0 719
8
2
8
0 602
8
2
8
0 141
8
2
8
0 298
8
2
8
0 630
8
2
8
0 740
8
2
8
0 735
8
2
8
0 905
8
2
8
0 501
8
2
8
0 590
8
2
8
0 195
8
2
8
1 195
8
0 971
8
2
8
0 566
8
2
8
1 566
8
0 667
8
2
8
0 483
8
2
8
1 483
8
0 213
...

result:

ok 

Test #39:

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

input:

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

output:

8
0 702
8
2
8
0 670
8
2
8
0 324
8
2
8
0 388
8
2
8
0 965
8
2
8
0 741
8
2
8
0 719
8
2
8
0 602
8
2
8
0 141
8
2
8
0 298
8
2
8
0 630
8
2
8
0 740
8
2
8
0 735
8
2
8
0 905
8
2
8
0 501
8
2
8
0 590
8
2
8
0 195
8
2
8
0 971
8
2
8
0 566
8
2
8
0 667
8
2
8
1 667
8
0 483
8
2
8
0 213
8
2
8
0 394
8
2
8
0 381
8
2
8
0 ...

result:

ok 

Test #40:

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

input:

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

output:

8
0 179
8
2
8
0 521
8
2
8
0 920
8
2
8
0 523
8
2
8
0 318
8
2
8
0 507
8
2
8
0 812
8
2
8
1 812
8
0 183
8
2
8
0 860
8
2
8
0 42
8
2
8
0 376
8
2
8
0 295
8
2
8
0 937
8
2
8
0 234
8
2
8
0 552
8
2
8
0 720
8
2
8
0 56
8
2
8
0 154
8
2
8
0 422
8
2
8
0 453
8
2
8
1 453
8
0 104
8
2
8
0 558
8
2
8
1 558
8
0 227
8
2
8
...

result:

ok 

Test #41:

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

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

output:

8
0 628
8
2
8
0 972
8
2
8
0 209
8
2
8
0 362
8
2
8
0 739
8
2
8
0 225
8
2
8
0 842
8
2
8
0 575
8
2
8
0 689
8
2
8
0 287
8
2
8
0 983
8
2
8
0 188
8
2
8
0 113
8
2
8
0 137
8
2
8
0 915
8
2
8
0 684
8
2
8
0 14
8
2
8
0 380
8
2
8
0 204
8
2
8
0 804
8
2
8
0 198
8
2
8
0 471
8
2
8
0 520
8
2
8
0 828
8
2
8
0 721
8
2
8...

result:

ok 

Test #42:

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

input:

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

output:

8
0 628
8
2
8
0 972
8
2
8
0 209
8
2
8
0 362
8
2
8
0 739
8
2
8
0 225
8
2
8
0 842
8
2
8
0 575
8
2
8
0 689
8
2
8
0 287
8
2
8
0 983
8
2
8
0 188
8
2
8
0 113
8
2
8
0 137
8
2
8
0 915
8
2
8
0 684
8
2
8
0 14
8
2
8
0 380
8
2
8
0 204
8
2
8
0 804
8
2
8
0 198
8
2
8
0 471
8
2
8
0 520
8
2
8
0 828
8
2
8
0 721
8
2
8...

result:

ok 

Subtask #3:

score: 44.5
Acceptable Answer

Test #43:

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

input:

2
1
2
2

output:

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

result:

ok 

Test #44:

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

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

input:

3
1
1
2
2

output:

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

result:

ok 

Test #46:

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

input:

6
1
2
2
1
2
2
2
3
3
3

output:

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

result:

ok 

Test #47:

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

input:

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

output:

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

result:

ok 

Test #48:

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

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 548
8
2
8
0 100
8
2
8
1 100
8
0 874
8
2
8
1 874
8
0 265
8
2
8
1 265
8
0 1513
8
2
8
1 1513
8
0 633
8
2
8
1 633
8
0 1149
8
2
8
1 1149
8
0 1126
8
2
8
1 1126
8
0 672
8
2
8
1 672
8
0 815
8
2
8
1 815
8
0 1592
8
2
8
1 1592
8
0 173
8
2
8
1 173
8
0 1281
8
2
8
1 1281
8
0 867
8
2
8
1 867
8
0 293
8
2
8
1 29...

result:

ok 

Test #49:

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

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 548
8
2
8
0 100
8
2
8
0 874
8
2
8
0 265
8
2
8
0 1513
8
2
8
0 633
8
2
8
0 1149
8
2
8
0 1126
8
2
8
0 672
8
2
8
0 815
8
2
8
0 1592
8
2
8
0 173
8
2
8
0 1281
8
2
8
0 867
8
2
8
0 293
8
2
8
0 1292
8
2
8
0 1599
8
2
8
0 1135
8
2
8
0 762
8
2
8
0 1739
8
2
8
0 1343
8
2
8
0 788
8
2
8
0 14
8
2
8
0 607
8
2
8
0...

result:

ok 

Test #50:

score: 57.67
Acceptable Answer
time: 12ms
memory: 3804kb

input:

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

output:

8
0 548
8
2
8
0 100
8
2
8
0 874
8
2
8
0 265
8
2
8
0 1513
8
2
8
0 633
8
2
8
1 633
8
0 1149
8
2
8
0 1126
8
2
8
0 672
8
2
8
0 815
8
2
8
0 1592
8
2
8
0 173
8
2
8
0 1281
8
2
8
0 867
8
2
8
1 867
8
0 293
8
2
8
1 293
8
0 1292
8
2
8
0 1599
8
2
8
1 1599
8
0 1135
8
2
8
1 1135
8
0 762
8
2
8
0 1739
8
2
8
0 1343
...

result:

points 0.76893333330 points  0.76893333330

Test #51:

score: 44.5
Acceptable Answer
time: 34ms
memory: 3784kb

input:

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

output:

8
0 548
8
2
8
0 100
8
2
8
0 874
8
2
8
0 265
8
2
8
0 1513
8
2
8
0 633
8
2
8
0 1149
8
2
8
0 1126
8
2
8
0 672
8
2
8
0 815
8
2
8
0 1592
8
2
8
0 173
8
2
8
0 1281
8
2
8
0 867
8
2
8
0 293
8
2
8
0 1292
8
2
8
1 1292
8
0 1599
8
2
8
1 1599
8
0 1135
8
2
8
1 1135
8
0 762
8
2
8
0 1739
8
2
8
0 1343
8
2
8
1 1343
8
...

result:

points 0.59333333330 points  0.59333333330

Test #52:

score: 75
Accepted
time: 7ms
memory: 3820kb

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 548
8
2
8
0 100
8
2
8
1 100
8
0 874
8
2
8
1 874
8
0 265
8
2
8
1 265
8
0 1513
8
2
8
1 1513
8
0 633
8
2
8
1 633
8
0 1149
8
2
8
1 1149
8
0 1126
8
2
8
1 1126
8
0 672
8
2
8
1 672
8
0 815
8
2
8
1 815
8
0 1592
8
2
8
1 1592
8
0 173
8
2
8
1 173
8
0 1281
8
2
8
1 1281
8
0 867
8
2
8
1 867
8
0 293
8
2
8
1 29...

result:

ok 

Test #53:

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

input:

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

output:

8
0 548
8
2
8
0 100
8
2
8
0 874
8
2
8
0 265
8
2
8
0 1513
8
2
8
0 633
8
2
8
1 633
8
0 1149
8
2
8
0 1126
8
2
8
1 1126
8
0 672
8
2
8
1 672
8
0 815
8
2
8
0 1592
8
2
8
0 173
8
2
8
0 1281
8
2
8
1 1281
8
0 867
8
2
8
1 867
8
0 293
8
2
8
1 293
8
0 1292
8
2
8
1 1292
8
0 1599
8
2
8
0 1135
8
2
8
0 762
8
2
8
0 1...

result:

ok 

Test #54:

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

input:

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

output:

8
0 548
8
2
8
0 100
8
2
8
0 874
8
2
8
1 874
8
0 265
8
2
8
1 265
8
0 1513
8
2
8
1 1513
8
0 633
8
2
8
0 1149
8
2
8
1 1149
8
0 1126
8
2
8
1 1126
8
0 672
8
2
8
1 672
8
0 815
8
2
8
1 815
8
0 1592
8
2
8
1 1592
8
0 173
8
2
8
1 173
8
0 1281
8
2
8
0 867
8
2
8
1 867
8
0 293
8
2
8
1 293
8
0 1292
8
2
8
1 1292
8...

result:

ok 

Test #55:

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

input:

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

output:

8
0 548
8
2
8
0 100
8
2
8
0 874
8
2
8
0 265
8
2
8
0 1513
8
2
8
1 1513
8
0 633
8
2
8
0 1149
8
2
8
0 1126
8
2
8
0 672
8
2
8
0 815
8
2
8
0 1592
8
2
8
0 173
8
2
8
1 173
8
0 1281
8
2
8
1 1281
8
0 867
8
2
8
0 293
8
2
8
1 293
8
0 1292
8
2
8
1 1292
8
0 1599
8
2
8
0 1135
8
2
8
0 762
8
2
8
0 1739
8
2
8
0 1343...

result:

ok 

Test #56:

score: 49.31
Acceptable Answer
time: 16ms
memory: 3816kb

input:

1998
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 889
8
2
8
0 593
8
2
8
0 147
8
2
8
1 147
8
0 951
8
2
8
0 1122
8
2
8
0 1846
8
2
8
1 1846
8
0 204
8
2
8
1 204
8
0 1264
8
2
8
1 1264
8
0 1566
8
2
8
1 1566
8
0 266
8
2
8
1 266
8
0 699
8
2
8
1 699
8
0 503
8
2
8
1 503
8
0 277
8
2
8
1 277
8
0 1004
8
2
8
1 1004
8
0 510
8
2
8
1 510
8
0 796
8
2
8
1 796
8
0...

result:

points 0.65746666670 points  0.65746666670

Test #57:

score: 59.08
Acceptable Answer
time: 20ms
memory: 3888kb

input:

1999
1
1
2
2
1
1
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1697
8
2
8
0 110
8
2
8
0 492
8
2
8
1 492
8
0 130
8
2
8
1 130
8
0 185
8
2
8
0 21
8
2
8
0 187
8
2
8
1 187
8
0 787
8
2
8
1 787
8
0 686
8
2
8
0 933
8
2
8
1 933
8
0 660
8
2
8
1 660
8
0 1717
8
2
8
1 1717
8
0 689
8
2
8
0 174
8
2
8
1 174
8
0 1245
8
2
8
1 1245
8
0 1995
8
2
8
0 34
8
2
8
1 34
8
0 589
8
2
8...

result:

points 0.78773333330 points  0.78773333330

Test #58:

score: 54.23
Acceptable Answer
time: 14ms
memory: 3752kb

input:

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

output:

8
0 1401
8
2
8
0 259
8
2
8
0 760
8
2
8
0 1842
8
2
8
1 1842
8
0 1956
8
2
8
1 1956
8
0 1787
8
2
8
1 1787
8
0 1035
8
2
8
1 1035
8
0 1267
8
2
8
0 1755
8
2
8
0 153
8
2
8
0 255
8
2
8
0 722
8
2
8
1 722
8
0 1145
8
2
8
0 1944
8
2
8
1 1944
8
0 584
8
2
8
1 584
8
0 948
8
2
8
1 948
8
0 1335
8
2
8
0 1404
8
2
8
0 ...

result:

points 0.72306666670 points  0.72306666670

Test #59:

score: 55.65
Acceptable Answer
time: 31ms
memory: 3816kb

input:

1998
1
1
1
1
1
2
1
2
2
1
1
2
2
1
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 889
8
2
8
0 593
8
2
8
0 147
8
2
8
0 951
8
2
8
0 1122
8
2
8
0 1846
8
2
8
1 1846
8
0 204
8
2
8
0 1264
8
2
8
1 1264
8
0 1566
8
2
8
1 1566
8
0 266
8
2
8
0 699
8
2
8
0 503
8
2
8
1 503
8
0 277
8
2
8
1 277
8
0 1004
8
2
8
0 510
8
2
8
1 510
8
0 796
8
2
8
1 796
8
0 1910
8
2
8
0 517
8
2
8
1 517
8
0 1167
8
...

result:

points 0.7420 points  0.7420

Test #60:

score: 53.34
Acceptable Answer
time: 8ms
memory: 4096kb

input:

1996
1
1
2
1
1
1
1
2
1
1
2
2
1
1
2
1
2
1
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1286
8
2
8
0 831
8
2
8
0 1085
8
2
8
1 1085
8
0 548
8
2
8
0 730
8
2
8
0 877
8
2
8
0 590
8
2
8
0 1244
8
2
8
1 1244
8
0 246
8
2
8
0 72
8
2
8
0 1756
8
2
8
1 1756
8
0 1907
8
2
8
1 1907
8
0 58
8
2
8
0 314
8
2
8
0 914
8
2
8
1 914
8
0 26
8
2
8
0 120
8
2
8
1 120
8
0 834
8
2
8
0 471
8
2
8
1 471
8
0 183
8
...

result:

points 0.71120 points  0.71120

Test #61:

score: 51.39
Acceptable Answer
time: 15ms
memory: 4096kb

input:

2000
1
1
1
1
1
1
1
2
1
2
2
1
1
1
2
2
2
1
1
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
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 548
8
2
8
0 100
8
2
8
0 874
8
2
8
0 265
8
2
8
0 1513
8
2
8
0 633
8
2
8
0 1149
8
2
8
0 1126
8
2
8
1 1126
8
0 672
8
2
8
0 815
8
2
8
1 815
8
0 1592
8
2
8
1 1592
8
0 173
8
2
8
0 1281
8
2
8
0 867
8
2
8
0 293
8
2
8
1 293
8
0 1292
8
2
8
1 1292
8
0 1599
8
2
8
1 1599
8
0 1135
8
2
8
0 762
8
2
8
0 1739
8
2...

result:

points 0.68520 points  0.68520

Test #62:

score: 61.77
Acceptable Answer
time: 7ms
memory: 3848kb

input:

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

output:

8
0 889
8
2
8
0 593
8
2
8
0 147
8
2
8
0 951
8
2
8
0 1122
8
2
8
0 1846
8
2
8
0 204
8
2
8
1 204
8
0 1264
8
2
8
0 1566
8
2
8
0 266
8
2
8
0 699
8
2
8
0 503
8
2
8
0 277
8
2
8
0 1004
8
2
8
0 510
8
2
8
0 796
8
2
8
0 1910
8
2
8
0 517
8
2
8
0 1167
8
2
8
0 388
8
2
8
1 388
8
0 1680
8
2
8
0 1458
8
2
8
0 126
8
2...

result:

points 0.82360 points  0.82360

Test #63:

score: 64.6
Acceptable Answer
time: 19ms
memory: 3784kb

input:

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

output:

8
0 548
8
2
8
0 100
8
2
8
0 874
8
2
8
0 265
8
2
8
0 1513
8
2
8
0 633
8
2
8
0 1149
8
2
8
0 1126
8
2
8
0 672
8
2
8
0 815
8
2
8
0 1592
8
2
8
0 173
8
2
8
0 1281
8
2
8
0 867
8
2
8
0 293
8
2
8
0 1292
8
2
8
0 1599
8
2
8
0 1135
8
2
8
0 762
8
2
8
1 762
8
0 1739
8
2
8
0 1343
8
2
8
0 788
8
2
8
1 788
8
0 14
8
2...

result:

points 0.86133333330 points  0.86133333330

Test #64:

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

input:

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

output:

8
0 672
8
2
8
0 1937
8
2
8
0 1373
8
2
8
0 387
8
2
8
0 1390
8
2
8
0 323
8
2
8
0 1272
8
2
8
0 773
8
2
8
0 1179
8
2
8
0 436
8
2
8
0 852
8
2
8
1 852
8
0 86
8
2
8
0 1739
8
2
8
0 1164
8
2
8
0 966
8
2
8
0 1634
8
2
8
0 684
8
2
8
1 684
8
0 793
8
2
8
0 83
8
2
8
0 1139
8
2
8
0 872
8
2
8
1 872
8
0 843
8
2
8
0 1...

result:

ok 

Test #65:

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

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

output:

8
0 1697
8
2
8
0 110
8
2
8
0 492
8
2
8
0 130
8
2
8
0 185
8
2
8
0 21
8
2
8
0 187
8
2
8
0 787
8
2
8
0 686
8
2
8
0 933
8
2
8
0 660
8
2
8
0 1717
8
2
8
0 689
8
2
8
0 174
8
2
8
0 1245
8
2
8
0 1995
8
2
8
0 34
8
2
8
0 589
8
2
8
0 398
8
2
8
0 1390
8
2
8
0 1030
8
2
8
0 220
8
2
8
0 1837
8
2
8
0 484
8
2
8
0 104...

result:

ok 

Test #66:

score: 75
Accepted
time: 3ms
memory: 3820kb

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

output:

8
0 889
8
2
8
0 593
8
2
8
0 147
8
2
8
0 951
8
2
8
0 1122
8
2
8
0 1846
8
2
8
0 204
8
2
8
0 1264
8
2
8
0 1566
8
2
8
0 266
8
2
8
0 699
8
2
8
0 503
8
2
8
0 277
8
2
8
0 1004
8
2
8
0 510
8
2
8
0 796
8
2
8
0 1910
8
2
8
0 517
8
2
8
0 1167
8
2
8
0 388
8
2
8
0 1680
8
2
8
0 1458
8
2
8
0 126
8
2
8
0 1995
8
2
8
...

result:

ok 

Test #67:

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

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

output:

8
0 1697
8
2
8
0 110
8
2
8
0 492
8
2
8
0 130
8
2
8
0 185
8
2
8
0 21
8
2
8
0 187
8
2
8
0 787
8
2
8
0 686
8
2
8
0 933
8
2
8
0 660
8
2
8
0 1717
8
2
8
0 689
8
2
8
0 174
8
2
8
0 1245
8
2
8
0 1995
8
2
8
0 34
8
2
8
0 589
8
2
8
0 398
8
2
8
0 1390
8
2
8
0 1030
8
2
8
0 220
8
2
8
0 1837
8
2
8
0 484
8
2
8
0 104...

result:

ok 

Test #68:

score: 60.99
Acceptable Answer
time: 41ms
memory: 3808kb

input:

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

output:

8
0 1597
8
2
8
0 1464
8
2
8
0 801
8
2
8
0 1578
8
2
8
0 158
8
2
8
0 1646
8
2
8
0 962
8
2
8
0 79
8
2
8
0 1818
8
2
8
1 1818
8
0 1118
8
2
8
0 507
8
2
8
0 1347
8
2
8
0 1219
8
2
8
0 800
8
2
8
0 1548
8
2
8
0 1789
8
2
8
0 1806
8
2
8
0 220
8
2
8
0 467
8
2
8
0 312
8
2
8
0 132
8
2
8
1 132
8
0 1674
8
2
8
0 219
...

result:

points 0.81320 points  0.81320

Test #69:

score: 60.93
Acceptable Answer
time: 6ms
memory: 3884kb

input:

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

output:

8
0 1597
8
2
8
0 1464
8
2
8
0 801
8
2
8
0 1578
8
2
8
0 158
8
2
8
0 1646
8
2
8
0 962
8
2
8
0 79
8
2
8
0 1818
8
2
8
1 1818
8
0 1118
8
2
8
0 507
8
2
8
0 1347
8
2
8
0 1219
8
2
8
0 800
8
2
8
0 1548
8
2
8
0 1789
8
2
8
0 1806
8
2
8
0 220
8
2
8
0 467
8
2
8
0 312
8
2
8
0 132
8
2
8
1 132
8
0 1674
8
2
8
0 219
...

result:

points 0.81240 points  0.81240

Test #70:

score: 52.41
Acceptable Answer
time: 10ms
memory: 3812kb

input:

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

output:

8
0 1597
8
2
8
0 1464
8
2
8
0 801
8
2
8
0 1578
8
2
8
0 158
8
2
8
0 1646
8
2
8
0 962
8
2
8
0 79
8
2
8
0 1818
8
2
8
0 1118
8
2
8
0 507
8
2
8
1 507
8
0 1347
8
2
8
1 1347
8
0 1219
8
2
8
0 800
8
2
8
0 1548
8
2
8
0 1789
8
2
8
1 1789
8
0 1806
8
2
8
0 220
8
2
8
1 220
8
0 467
8
2
8
0 312
8
2
8
1 312
8
0 132
...

result:

points 0.69880 points  0.69880

Test #71:

score: 54.47
Acceptable Answer
time: 17ms
memory: 3796kb

input:

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

output:

8
0 1597
8
2
8
0 1464
8
2
8
0 801
8
2
8
0 1578
8
2
8
0 158
8
2
8
0 1646
8
2
8
0 962
8
2
8
0 79
8
2
8
0 1818
8
2
8
0 1118
8
2
8
0 507
8
2
8
1 507
8
0 1347
8
2
8
1 1347
8
0 1219
8
2
8
0 800
8
2
8
0 1548
8
2
8
0 1789
8
2
8
1 1789
8
0 1806
8
2
8
0 220
8
2
8
1 220
8
0 467
8
2
8
0 312
8
2
8
1 312
8
0 132
...

result:

points 0.72626666670 points  0.72626666670

Test #72:

score: 65.22
Acceptable Answer
time: 15ms
memory: 3760kb

input:

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

output:

8
0 456
8
2
8
0 717
8
2
8
0 147
8
2
8
0 20
8
2
8
0 344
8
2
8
0 1530
8
2
8
0 82
8
2
8
0 1684
8
2
8
0 624
8
2
8
0 109
8
2
8
0 473
8
2
8
0 1947
8
2
8
0 126
8
2
8
0 754
8
2
8
0 1069
8
2
8
0 574
8
2
8
1 574
8
0 878
8
2
8
0 382
8
2
8
0 1305
8
2
8
1 1305
8
0 854
8
2
8
1 854
8
0 1816
8
2
8
1 1816
8
0 914
8
...

result:

points 0.86960 points  0.86960

Test #73:

score: 70.17
Acceptable Answer
time: 10ms
memory: 3756kb

input:

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

output:

8
0 456
8
2
8
0 717
8
2
8
0 147
8
2
8
0 20
8
2
8
0 344
8
2
8
0 1530
8
2
8
0 82
8
2
8
0 1684
8
2
8
0 624
8
2
8
0 109
8
2
8
0 473
8
2
8
0 1947
8
2
8
0 126
8
2
8
0 754
8
2
8
1 754
8
0 1069
8
2
8
0 574
8
2
8
0 878
8
2
8
0 382
8
2
8
1 382
8
0 1305
8
2
8
0 854
8
2
8
0 1816
8
2
8
1 1816
8
0 914
8
2
8
0 32
...

result:

points 0.93560 points  0.93560

Test #74:

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

input:

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

output:

8
0 1407
8
2
8
0 1611
8
2
8
0 1623
8
2
8
0 1620
8
2
8
0 1133
8
2
8
0 451
8
2
8
1 451
8
0 1294
8
2
8
0 999
8
2
8
0 607
8
2
8
0 758
8
2
8
0 311
8
2
8
0 494
8
2
8
0 1690
8
2
8
0 239
8
2
8
0 750
8
2
8
0 591
8
2
8
0 1934
8
2
8
0 796
8
2
8
0 1859
8
2
8
0 331
8
2
8
0 1282
8
2
8
0 848
8
2
8
0 1642
8
2
8
1 1...

result:

ok 

Test #75:

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

input:

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

output:

8
0 1407
8
2
8
0 1611
8
2
8
0 1623
8
2
8
0 1620
8
2
8
0 1133
8
2
8
0 451
8
2
8
1 451
8
0 1294
8
2
8
0 999
8
2
8
0 607
8
2
8
0 758
8
2
8
0 311
8
2
8
0 494
8
2
8
0 1690
8
2
8
0 239
8
2
8
0 750
8
2
8
0 591
8
2
8
0 1934
8
2
8
0 796
8
2
8
0 1859
8
2
8
0 331
8
2
8
0 1282
8
2
8
0 848
8
2
8
0 1642
8
2
8
1 1...

result:

ok 

Test #76:

score: 60.7
Acceptable Answer
time: 15ms
memory: 3816kb

input:

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

output:

8
0 503
8
2
8
0 640
8
2
8
0 808
8
2
8
0 222
8
2
8
0 930
8
2
8
0 432
8
2
8
0 1041
8
2
8
0 1901
8
2
8
0 1658
8
2
8
0 233
8
2
8
1 233
8
0 247
8
2
8
0 1140
8
2
8
0 1078
8
2
8
0 377
8
2
8
0 603
8
2
8
1 603
8
0 214
8
2
8
0 135
8
2
8
0 321
8
2
8
0 410
8
2
8
0 429
8
2
8
0 160
8
2
8
0 761
8
2
8
1 761
8
0 196...

result:

points 0.80933333330 points  0.80933333330

Test #77:

score: 60.1
Acceptable Answer
time: 18ms
memory: 4100kb

input:

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

output:

8
0 503
8
2
8
0 640
8
2
8
0 808
8
2
8
0 222
8
2
8
0 930
8
2
8
0 432
8
2
8
0 1041
8
2
8
0 1901
8
2
8
0 1658
8
2
8
0 233
8
2
8
0 247
8
2
8
0 1140
8
2
8
0 1078
8
2
8
0 377
8
2
8
0 603
8
2
8
0 214
8
2
8
0 135
8
2
8
1 135
8
0 321
8
2
8
1 321
8
0 410
8
2
8
0 429
8
2
8
0 160
8
2
8
0 761
8
2
8
0 1968
8
2
8
...

result:

points 0.80133333330 points  0.80133333330

Test #78:

score: 67.03
Acceptable Answer
time: 0ms
memory: 4104kb

input:

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

output:

8
0 145
8
2
8
0 1615
8
2
8
0 54
8
2
8
0 79
8
2
8
0 1023
8
2
8
1 1023
8
0 1282
8
2
8
0 584
8
2
8
0 99
8
2
8
0 868
8
2
8
0 16
8
2
8
0 630
8
2
8
1 630
8
0 679
8
2
8
0 1002
8
2
8
0 1334
8
2
8
0 1357
8
2
8
0 44
8
2
8
0 1945
8
2
8
0 587
8
2
8
0 551
8
2
8
1 551
8
0 727
8
2
8
0 1109
8
2
8
0 1081
8
2
8
1 108...

result:

points 0.89373333330 points  0.89373333330

Test #79:

score: 64.1
Acceptable Answer
time: 14ms
memory: 4104kb

input:

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

output:

8
0 145
8
2
8
0 1615
8
2
8
0 54
8
2
8
0 79
8
2
8
0 1023
8
2
8
1 1023
8
0 1282
8
2
8
0 584
8
2
8
0 99
8
2
8
0 868
8
2
8
0 16
8
2
8
0 630
8
2
8
1 630
8
0 679
8
2
8
0 1002
8
2
8
0 1334
8
2
8
0 1357
8
2
8
0 44
8
2
8
0 1945
8
2
8
0 587
8
2
8
0 551
8
2
8
1 551
8
0 727
8
2
8
0 1109
8
2
8
0 1081
8
2
8
1 108...

result:

points 0.85466666670 points  0.85466666670

Test #80:

score: 66.6
Acceptable Answer
time: 21ms
memory: 4068kb

input:

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

output:

8
0 548
8
2
8
0 100
8
2
8
0 874
8
2
8
0 265
8
2
8
0 1513
8
2
8
0 633
8
2
8
0 1149
8
2
8
0 1126
8
2
8
0 672
8
2
8
0 815
8
2
8
0 1592
8
2
8
0 173
8
2
8
0 1281
8
2
8
0 867
8
2
8
1 867
8
0 293
8
2
8
0 1292
8
2
8
0 1599
8
2
8
0 1135
8
2
8
0 762
8
2
8
0 1739
8
2
8
0 1343
8
2
8
1 1343
8
0 788
8
2
8
0 14
8
...

result:

points 0.8880 points  0.8880

Test #81:

score: 65.91
Acceptable Answer
time: 15ms
memory: 3812kb

input:

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

output:

8
0 548
8
2
8
0 100
8
2
8
0 874
8
2
8
0 265
8
2
8
0 1513
8
2
8
0 633
8
2
8
0 1149
8
2
8
0 1126
8
2
8
0 672
8
2
8
0 815
8
2
8
0 1592
8
2
8
0 173
8
2
8
0 1281
8
2
8
0 867
8
2
8
1 867
8
0 293
8
2
8
0 1292
8
2
8
0 1599
8
2
8
0 1135
8
2
8
0 762
8
2
8
0 1739
8
2
8
0 1343
8
2
8
1 1343
8
0 788
8
2
8
0 14
8
...

result:

points 0.87880 points  0.87880

Test #82:

score: 60.9
Acceptable Answer
time: 4ms
memory: 3804kb

input:

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

output:

8
0 548
8
2
8
0 100
8
2
8
0 874
8
2
8
0 265
8
2
8
1 265
8
0 1513
8
2
8
0 633
8
2
8
0 1149
8
2
8
0 1126
8
2
8
0 672
8
2
8
0 815
8
2
8
0 1592
8
2
8
0 173
8
2
8
0 1281
8
2
8
0 867
8
2
8
0 293
8
2
8
0 1292
8
2
8
0 1599
8
2
8
0 1135
8
2
8
0 762
8
2
8
1 762
8
0 1739
8
2
8
0 1343
8
2
8
0 788
8
2
8
1 788
8
...

result:

points 0.8120 points  0.8120

Test #83:

score: 58.1
Acceptable Answer
time: 7ms
memory: 3824kb

input:

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

output:

8
0 548
8
2
8
0 100
8
2
8
0 874
8
2
8
0 265
8
2
8
0 1513
8
2
8
0 633
8
2
8
0 1149
8
2
8
0 1126
8
2
8
0 672
8
2
8
0 815
8
2
8
0 1592
8
2
8
1 1592
8
0 173
8
2
8
0 1281
8
2
8
1 1281
8
0 867
8
2
8
0 293
8
2
8
1 293
8
0 1292
8
2
8
0 1599
8
2
8
1 1599
8
0 1135
8
2
8
1 1135
8
0 762
8
2
8
0 1739
8
2
8
1 173...

result:

points 0.77466666670 points  0.77466666670

Test #84:

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

input:

540
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 371
8
2
8
0 346
8
2
8
1 346
8
0 267
8
2
8
1 267
8
0 15
8
2
8
1 15
8
0 324
8
2
8
0 303
8
2
8
1 303
8
0 297
8
2
8
1 297
8
0 345
8
2
8
1 345
8
0 50
8
2
8
1 50
8
0 220
8
2
8
1 220
8
0 379
8
2
8
1 379
8
0 11
8
2
8
1 11
8
0 98
8
2
8
1 98
8
0 208
8
2
8
1 208
8
0 438
8
2
8
1 438
8
0 490
8
2
8
0 285
8
2
...

result:

ok 

Test #85:

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

input:

1834
1
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 602
8
2
8
0 903
8
2
8
1 903
8
0 427
8
2
8
1 427
8
0 512
8
2
8
1 512
8
0 44
8
2
8
0 1492
8
2
8
1 1492
8
0 1516
8
2
8
0 470
8
2
8
1 470
8
0 25
8
2
8
1 25
8
0 451
8
2
8
1 451
8
0 1483
8
2
8
1 1483
8
0 906
8
2
8
1 906
8
0 1372
8
2
8
1 1372
8
0 668
8
2
8
1 668
8
0 173
8
2
8
1 173
8
0 348
8
2
8
1 348
...

result:

ok 

Test #86:

score: 73.48
Acceptable Answer
time: 0ms
memory: 3824kb

input:

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

output:

8
0 548
8
2
8
0 100
8
2
8
0 874
8
2
8
1 874
8
0 265
8
2
8
1 265
8
0 1513
8
2
8
1 1513
8
0 633
8
2
8
1 633
8
0 1149
8
2
8
1 1149
8
0 1126
8
2
8
1 1126
8
0 672
8
2
8
1 672
8
0 815
8
2
8
1 815
8
0 1592
8
2
8
1 1592
8
0 173
8
2
8
1 173
8
0 1281
8
2
8
1 1281
8
0 867
8
2
8
1 867
8
0 293
8
2
8
1 293
8
0 12...

result:

points 0.97973333330 points  0.97973333330

Test #87:

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

input:

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

output:

8
0 548
8
2
8
0 100
8
2
8
1 100
8
0 874
8
2
8
1 874
8
0 265
8
2
8
1 265
8
0 1513
8
2
8
0 633
8
2
8
1 633
8
0 1149
8
2
8
0 1126
8
2
8
0 672
8
2
8
1 672
8
0 815
8
2
8
1 815
8
0 1592
8
2
8
0 173
8
2
8
1 173
8
0 1281
8
2
8
0 867
8
2
8
1 867
8
0 293
8
2
8
1 293
8
0 1292
8
2
8
0 1599
8
2
8
0 1135
8
2
8
0 ...

result:

ok 

Test #88:

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

input:

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

output:

8
0 548
8
2
8
0 100
8
2
8
0 874
8
2
8
0 265
8
2
8
0 1513
8
2
8
0 633
8
2
8
0 1149
8
2
8
1 1149
8
0 1126
8
2
8
1 1126
8
0 672
8
2
8
0 815
8
2
8
0 1592
8
2
8
1 1592
8
0 173
8
2
8
0 1281
8
2
8
1 1281
8
0 867
8
2
8
0 293
8
2
8
0 1292
8
2
8
1 1292
8
0 1599
8
2
8
1 1599
8
0 1135
8
2
8
1 1135
8
0 762
8
2
8...

result:

ok 

Test #89:

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

input:

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

output:

8
0 548
8
2
8
0 100
8
2
8
0 874
8
2
8
0 265
8
2
8
1 265
8
0 1513
8
2
8
1 1513
8
0 633
8
2
8
0 1149
8
2
8
0 1126
8
2
8
0 672
8
2
8
0 815
8
2
8
0 1592
8
2
8
1 1592
8
0 173
8
2
8
1 173
8
0 1281
8
2
8
0 867
8
2
8
0 293
8
2
8
1 293
8
0 1292
8
2
8
0 1599
8
2
8
1 1599
8
0 1135
8
2
8
0 762
8
2
8
0 1739
8
2
...

result:

ok