QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#140388#4565. Rarest Insectssomethingnew#65.49 34ms4120kbC++203.9kb2023-08-15 20:52:542024-07-04 01:44:42

Judging History

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

  • [2024-07-04 01:44:42]
  • 评测
  • 测评结果:65.49
  • 用时:34ms
  • 内存:4120kb
  • [2023-08-15 20:52:54]
  • 提交

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]);
    }
    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() {
    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;
        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: 4092kb

input:

6
1
1
2
1
2
2
2
3
2
3

output:

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

result:

ok 

Test #2:

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

input:

2
1
2
2

output:

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

result:

ok 

Test #3:

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

input:

2
1
1

output:

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

result:

ok 

Test #4:

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

input:

3
1
2
1
2

output:

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

result:

ok 

Test #5:

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

input:

5
1
2
2
1
2
2
2
3

output:

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

result:

ok 

Test #6:

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

input:

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

output:

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

result:

ok 

Test #7:

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

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 19
8
2
8
0 68
8
2
8
1 68
8
0 92
8
2
8
1 92
8
0 49
8
2
8
1 49
8
0 184
8
2
8
1 184
8
0 62
8
2
8
1 62
8
0 191
8
2
8
1 191
8
0 107
8
2
8
1 107
8
0 149
8
2
8
1 149
8
0 88
8
2
8
1 88
8
0 21
8
2
8
1 21
8
0 152
8
2
8
1 152
8
0 97
8
2
8
1 97
8
0 27
8
2
8
1 27
8
0 75
8
2
8
1 75
8
0 29
8
2
8
1 29
8
0 114
8...

result:

ok 

Test #8:

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

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 86
8
2
8
0 174
8
2
8
0 134
8
2
8
0 159
8
2
8
0 17
8
2
8
0 139
8
2
8
0 87
8
2
8
0 3
8
2
8
0 69
8
2
8
0 189
8
2
8
0 38
8
2
8
0 165
8
2
8
0 192
8
2
8
0 26
8
2
8
0 39
8
2
8
0 199
8
2
8
0 119
8
2
8
0 4
8
2
8
0 36
8
2
8
0 106
8
2
8
0 132
8
2
8
0 20
8
2
8
0 54
8
2
8
0 14
8
2
8
0 172
8
2
8
0 150
8
2
8
0...

result:

ok 

Test #9:

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

input:

200
1
1
1
1
1
1
2
2
2
1
1
2
1
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 174
8
2
8
0 134
8
2
8
0 159
8
2
8
0 17
8
2
8
0 139
8
2
8
0 87
8
2
8
1 87
8
0 3
8
2
8
1 3
8
0 69
8
2
8
1 69
8
0 189
8
2
8
0 38
8
2
8
0 165
8
2
8
1 165
8
0 192
8
2
8
0 26
8
2
8
1 26
8
0 39
8
2
8
1 39
8
0 199
8
2
8
0 119
8
2
8
1 119
8
0 4
8
2
8
0 36
8
2
8
0 106
8
2
8
1 106
8
0 132
8
2
8
...

result:

ok 

Test #10:

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

input:

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

output:

8
0 116
8
2
8
0 197
8
2
8
0 165
8
2
8
0 185
8
2
8
0 136
8
2
8
1 136
8
0 44
8
2
8
1 44
8
0 54
8
2
8
0 121
8
2
8
0 40
8
2
8
0 169
8
2
8
0 79
8
2
8
0 113
8
2
8
1 113
8
0 1
8
2
8
0 32
8
2
8
1 32
8
0 25
8
2
8
0 192
8
2
8
1 192
8
0 123
8
2
8
1 123
8
0 47
8
2
8
1 47
8
0 70
8
2
8
0 41
8
2
8
1 41
8
0 91
8
2
...

result:

ok 

Test #11:

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

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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 19
8
2
8
0 68
8
2
8
1 68
8
0 92
8
2
8
1 92
8
0 49
8
2
8
1 49
8
0 184
8
2
8
1 184
8
0 62
8
2
8
1 62
8
0 191
8
2
8
1 191
8
0 107
8
2
8
1 107
8
0 149
8
2
8
1 149
8
0 88
8
2
8
1 88
8
0 21
8
2
8
1 21
8
0 152
8
2
8
1 152
8
0 97
8
2
8
1 97
8
0 27
8
2
8
1 27
8
0 75
8
2
8
1 75
8
0 29
8
2
8
1 29
8
0 114
8...

result:

ok 

Test #12:

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

input:

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

output:

8
0 97
8
2
8
0 7
8
2
8
0 68
8
2
8
1 68
8
0 44
8
2
8
1 44
8
0 126
8
2
8
1 126
8
0 160
8
2
8
0 72
8
2
8
1 72
8
0 189
8
2
8
0 128
8
2
8
0 4
8
2
8
0 57
8
2
8
0 52
8
2
8
0 11
8
2
8
1 11
8
0 1
8
2
8
0 147
8
2
8
1 147
8
0 35
8
2
8
0 116
8
2
8
0 169
8
2
8
1 169
8
0 26
8
2
8
1 26
8
0 165
8
2
8
0 183
8
2
8
1 ...

result:

ok 

Test #13:

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

input:

197
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
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 7
8
2
8
0 68
8
2
8
1 68
8
0 44
8
2
8
0 126
8
2
8
1 126
8
0 160
8
2
8
1 160
8
0 72
8
2
8
1 72
8
0 189
8
2
8
0 128
8
2
8
1 128
8
0 4
8
2
8
1 4
8
0 57
8
2
8
1 57
8
0 52
8
2
8
1 52
8
0 11
8
2
8
1 11
8
0 1
8
2
8
1 1
8
0 147
8
2
8
1 147
8
0 35
8
2
8
1 35
8
0 116
8
2
8
1 116
8
0 169
8
2
8
1 ...

result:

ok 

Test #14:

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

input:

198
1
1
1
2
1
1
1
1
2
1
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
1
2
2
2
2
2
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
1
2
2
2
2
2
2
2
2
2
2
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 116
8
2
8
0 197
8
2
8
0 165
8
2
8
0 185
8
2
8
1 185
8
0 136
8
2
8
0 44
8
2
8
0 54
8
2
8
0 121
8
2
8
0 40
8
2
8
1 40
8
0 169
8
2
8
0 79
8
2
8
1 79
8
0 113
8
2
8
0 1
8
2
8
1 1
8
0 32
8
2
8
0 25
8
2
8
1 25
8
0 192
8
2
8
1 192
8
0 123
8
2
8
1 123
8
0 47
8
2
8
1 47
8
0 70
8
2
8
1 70
8
0 41
8
2
8
1 41...

result:

ok 

Test #15:

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

input:

200
1
1
1
2
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 174
8
2
8
0 134
8
2
8
0 159
8
2
8
1 159
8
0 17
8
2
8
1 17
8
0 139
8
2
8
1 139
8
0 87
8
2
8
1 87
8
0 3
8
2
8
0 69
8
2
8
1 69
8
0 189
8
2
8
1 189
8
0 38
8
2
8
1 38
8
0 165
8
2
8
1 165
8
0 192
8
2
8
1 192
8
0 26
8
2
8
1 26
8
0 39
8
2
8
1 39
8
0 199
8
2
8
0 119
8
2
8
1 119
8
0 4
8
2
8
1 4...

result:

ok 

Test #16:

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

input:

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

output:

8
0 171
8
2
8
0 26
8
2
8
0 152
8
2
8
1 152
8
0 159
8
2
8
0 43
8
2
8
0 167
8
2
8
0 9
8
2
8
0 145
8
2
8
1 145
8
0 98
8
2
8
1 98
8
0 87
8
2
8
0 181
8
2
8
1 181
8
0 19
8
2
8
1 19
8
0 139
8
2
8
0 132
8
2
8
1 132
8
0 59
8
2
8
1 59
8
0 135
8
2
8
1 135
8
0 10
8
2
8
1 10
8
0 24
8
2
8
1 24
8
0 3
8
2
8
1 3
8
0...

result:

ok 

Test #17:

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

input:

199
1
1
1
2
1
2
1
1
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 19
8
2
8
0 68
8
2
8
0 92
8
2
8
0 49
8
2
8
1 49
8
0 184
8
2
8
0 62
8
2
8
1 62
8
0 191
8
2
8
0 107
8
2
8
0 149
8
2
8
1 149
8
0 88
8
2
8
0 21
8
2
8
1 21
8
0 152
8
2
8
1 152
8
0 97
8
2
8
1 97
8
0 27
8
2
8
1 27
8
0 75
8
2
8
0 29
8
2
8
1 29
8
0 114
8
2
8
1 114
8
0 34
8
2
8
1 34
8
0 154
8
2
8
1 154
8
0...

result:

ok 

Test #18:

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

input:

196
1
1
1
2
1
1
1
1
2
2
2
1
2
2
2
2
1
1
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 171
8
2
8
0 26
8
2
8
0 152
8
2
8
0 159
8
2
8
1 159
8
0 43
8
2
8
0 167
8
2
8
0 9
8
2
8
0 145
8
2
8
0 98
8
2
8
1 98
8
0 87
8
2
8
1 87
8
0 181
8
2
8
1 181
8
0 19
8
2
8
0 139
8
2
8
1 139
8
0 132
8
2
8
1 132
8
0 59
8
2
8
1 59
8
0 135
8
2
8
1 135
8
0 10
8
2
8
0 24
8
2
8
0 3
8
2
8
1 3
8
0 74
8
2
8
1 74...

result:

ok 

Test #19:

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

input:

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

output:

8
0 171
8
2
8
0 26
8
2
8
0 152
8
2
8
1 152
8
0 159
8
2
8
1 159
8
0 43
8
2
8
0 167
8
2
8
1 167
8
0 9
8
2
8
0 145
8
2
8
0 98
8
2
8
1 98
8
0 87
8
2
8
0 181
8
2
8
0 19
8
2
8
1 19
8
0 139
8
2
8
1 139
8
0 132
8
2
8
1 132
8
0 59
8
2
8
0 135
8
2
8
1 135
8
0 10
8
2
8
0 24
8
2
8
1 24
8
0 3
8
2
8
0 74
8
2
8
0 ...

result:

ok 

Test #20:

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

input:

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

output:

8
0 171
8
2
8
0 26
8
2
8
0 152
8
2
8
0 159
8
2
8
1 159
8
0 43
8
2
8
0 167
8
2
8
0 9
8
2
8
0 145
8
2
8
0 98
8
2
8
0 87
8
2
8
1 87
8
0 181
8
2
8
0 19
8
2
8
0 139
8
2
8
1 139
8
0 132
8
2
8
0 59
8
2
8
1 59
8
0 135
8
2
8
0 10
8
2
8
1 10
8
0 24
8
2
8
1 24
8
0 3
8
2
8
1 3
8
0 74
8
2
8
1 74
8
0 79
8
2
8
1 7...

result:

ok 

Test #21:

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

input:

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

output:

8
0 86
8
2
8
0 174
8
2
8
0 134
8
2
8
0 159
8
2
8
0 17
8
2
8
0 139
8
2
8
0 87
8
2
8
0 3
8
2
8
0 69
8
2
8
0 189
8
2
8
0 38
8
2
8
0 165
8
2
8
0 192
8
2
8
0 26
8
2
8
0 39
8
2
8
0 199
8
2
8
0 119
8
2
8
0 4
8
2
8
0 36
8
2
8
0 106
8
2
8
1 106
8
0 132
8
2
8
0 20
8
2
8
0 54
8
2
8
0 14
8
2
8
0 172
8
2
8
0 150...

result:

ok 

Test #22:

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

input:

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

output:

8
0 19
8
2
8
0 68
8
2
8
0 92
8
2
8
0 49
8
2
8
0 184
8
2
8
0 62
8
2
8
0 191
8
2
8
0 107
8
2
8
0 149
8
2
8
0 88
8
2
8
0 21
8
2
8
0 152
8
2
8
0 97
8
2
8
0 27
8
2
8
0 75
8
2
8
1 75
8
0 29
8
2
8
0 114
8
2
8
0 34
8
2
8
0 154
8
2
8
0 24
8
2
8
0 132
8
2
8
0 25
8
2
8
1 25
8
0 37
8
2
8
0 84
8
2
8
1 84
8
0 41
...

result:

ok 

Test #23:

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

input:

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

output:

8
0 116
8
2
8
0 197
8
2
8
0 165
8
2
8
0 185
8
2
8
0 136
8
2
8
0 44
8
2
8
0 54
8
2
8
0 121
8
2
8
0 40
8
2
8
0 169
8
2
8
0 79
8
2
8
0 113
8
2
8
0 1
8
2
8
0 32
8
2
8
0 25
8
2
8
0 192
8
2
8
0 123
8
2
8
0 47
8
2
8
0 70
8
2
8
0 41
8
2
8
0 91
8
2
8
1 91
8
0 36
8
2
8
0 74
8
2
8
0 135
8
2
8
0 77
8
2
8
0 6
8
...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

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

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 977
8
2
8
0 682
8
2
8
1 682
8
0 734
8
2
8
1 734
8
0 286
8
2
8
1 286
8
0 944
8
2
8
1 944
8
0 620
8
2
8
1 620
8
0 822
8
2
8
1 822
8
0 223
8
2
8
1 223
8
0 602
8
2
8
1 602
8
0 36
8
2
8
1 36
8
0 871
8
2
8
1 871
8
0 565
8
2
8
1 565
8
0 790
8
2
8
1 790
8
0 426
8
2
8
1 426
8
0 947
8
2
8
1 947
8
0 720
8
...

result:

ok 

Test #25:

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

input:

1000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

8
0 977
8
2
8
0 682
8
2
8
0 734
8
2
8
0 286
8
2
8
0 944
8
2
8
0 620
8
2
8
0 822
8
2
8
0 223
8
2
8
0 602
8
2
8
0 36
8
2
8
0 871
8
2
8
0 565
8
2
8
0 790
8
2
8
0 426
8
2
8
0 947
8
2
8
0 720
8
2
8
0 739
8
2
8
0 804
8
2
8
0 317
8
2
8
0 535
8
2
8
0 401
8
2
8
0 609
8
2
8
0 409
8
2
8
0 39
8
2
8
0 843
8
2
8
...

result:

ok 

Test #26:

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

input:

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

output:

8
0 326
8
2
8
0 121
8
2
8
0 534
8
2
8
0 953
8
2
8
0 119
8
2
8
0 161
8
2
8
1 161
8
0 275
8
2
8
0 269
8
2
8
0 541
8
2
8
0 347
8
2
8
1 347
8
0 495
8
2
8
0 605
8
2
8
0 78
8
2
8
0 330
8
2
8
0 428
8
2
8
0 7
8
2
8
1 7
8
0 648
8
2
8
0 856
8
2
8
0 187
8
2
8
1 187
8
0 129
8
2
8
1 129
8
0 629
8
2
8
1 629
8
0 1...

result:

ok 

Test #27:

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

input:

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

output:

8
0 326
8
2
8
0 121
8
2
8
0 534
8
2
8
0 953
8
2
8
0 119
8
2
8
1 119
8
0 161
8
2
8
0 275
8
2
8
0 269
8
2
8
0 541
8
2
8
1 541
8
0 347
8
2
8
1 347
8
0 495
8
2
8
0 605
8
2
8
1 605
8
0 78
8
2
8
0 330
8
2
8
1 330
8
0 428
8
2
8
1 428
8
0 7
8
2
8
0 648
8
2
8
0 856
8
2
8
1 856
8
0 187
8
2
8
1 187
8
0 129
8
2...

result:

ok 

Test #28:

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

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 668
8
2
8
0 714
8
2
8
1 714
8
0 614
8
2
8
1 614
8
0 199
8
2
8
1 199
8
0 814
8
2
8
1 814
8
0 566
8
2
8
1 566
8
0 142
8
2
8
1 142
8
0 569
8
2
8
1 569
8
0 985
8
2
8
1 985
8
0 931
8
2
8
1 931
8
0 471
8
2
8
1 471
8
0 535
8
2
8
1 535
8
0 516
8
2
8
1 516
8
0 270
8
2
8
1 270
8
0 558
8
2
8
1 558
8
0 617
...

result:

ok 

Test #29:

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

input:

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

output:

8
0 910
8
2
8
0 641
8
2
8
0 540
8
2
8
0 894
8
2
8
0 924
8
2
8
0 522
8
2
8
1 522
8
0 589
8
2
8
1 589
8
0 97
8
2
8
0 348
8
2
8
0 610
8
2
8
1 610
8
0 25
8
2
8
0 722
8
2
8
0 622
8
2
8
0 606
8
2
8
1 606
8
0 415
8
2
8
1 415
8
0 592
8
2
8
0 454
8
2
8
0 179
8
2
8
0 290
8
2
8
1 290
8
0 621
8
2
8
0 199
8
2
8
...

result:

ok 

Test #30:

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

input:

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

output:

8
0 60
8
2
8
0 472
8
2
8
0 849
8
2
8
0 627
8
2
8
1 627
8
0 336
8
2
8
1 336
8
0 968
8
2
8
1 968
8
0 989
8
2
8
1 989
8
0 520
8
2
8
0 108
8
2
8
1 108
8
0 296
8
2
8
1 296
8
0 379
8
2
8
1 379
8
0 573
8
2
8
1 573
8
0 814
8
2
8
1 814
8
0 384
8
2
8
1 384
8
0 219
8
2
8
1 219
8
0 941
8
2
8
1 941
8
0 80
8
2
8
...

result:

ok 

Test #31:

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

input:

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

output:

8
0 60
8
2
8
0 472
8
2
8
0 849
8
2
8
0 627
8
2
8
0 336
8
2
8
1 336
8
0 968
8
2
8
1 968
8
0 989
8
2
8
0 520
8
2
8
0 108
8
2
8
0 296
8
2
8
0 379
8
2
8
1 379
8
0 573
8
2
8
0 814
8
2
8
0 384
8
2
8
1 384
8
0 219
8
2
8
1 219
8
0 941
8
2
8
1 941
8
0 80
8
2
8
0 494
8
2
8
1 494
8
0 839
8
2
8
0 973
8
2
8
0 79...

result:

ok 

Test #32:

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

input:

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

output:

8
0 977
8
2
8
0 682
8
2
8
0 734
8
2
8
0 286
8
2
8
1 286
8
0 944
8
2
8
0 620
8
2
8
1 620
8
0 822
8
2
8
0 223
8
2
8
1 223
8
0 602
8
2
8
1 602
8
0 36
8
2
8
1 36
8
0 871
8
2
8
1 871
8
0 565
8
2
8
1 565
8
0 790
8
2
8
1 790
8
0 426
8
2
8
1 426
8
0 947
8
2
8
1 947
8
0 720
8
2
8
1 720
8
0 739
8
2
8
1 739
8
...

result:

ok 

Test #33:

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

input:

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

output:

8
0 668
8
2
8
0 714
8
2
8
0 614
8
2
8
0 199
8
2
8
0 814
8
2
8
1 814
8
0 566
8
2
8
1 566
8
0 142
8
2
8
0 569
8
2
8
1 569
8
0 985
8
2
8
1 985
8
0 931
8
2
8
0 471
8
2
8
1 471
8
0 535
8
2
8
1 535
8
0 516
8
2
8
0 270
8
2
8
1 270
8
0 558
8
2
8
0 617
8
2
8
1 617
8
0 433
8
2
8
1 433
8
0 357
8
2
8
1 357
8
0 ...

result:

ok 

Test #34:

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

input:

1000
1
1
1
1
2
1
1
1
2
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 977
8
2
8
0 682
8
2
8
0 734
8
2
8
0 286
8
2
8
0 944
8
2
8
1 944
8
0 620
8
2
8
0 822
8
2
8
0 223
8
2
8
0 602
8
2
8
1 602
8
0 36
8
2
8
1 36
8
0 871
8
2
8
0 565
8
2
8
1 565
8
0 790
8
2
8
1 790
8
0 426
8
2
8
1 426
8
0 947
8
2
8
1 947
8
0 720
8
2
8
1 720
8
0 739
8
2
8
1 739
8
0 804
8
2
8
1 804
8
0 31...

result:

ok 

Test #35:

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

input:

1000
1
1
1
1
1
1
1
2
2
2
2
2
2
1
1
2
2
2
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 977
8
2
8
0 682
8
2
8
0 734
8
2
8
0 286
8
2
8
0 944
8
2
8
0 620
8
2
8
0 822
8
2
8
0 223
8
2
8
1 223
8
0 602
8
2
8
1 602
8
0 36
8
2
8
1 36
8
0 871
8
2
8
1 871
8
0 565
8
2
8
1 565
8
0 790
8
2
8
1 790
8
0 426
8
2
8
0 947
8
2
8
0 720
8
2
8
1 720
8
0 739
8
2
8
1 739
8
0 804
8
2
8
1 804
8
0 317
8
2
8
...

result:

ok 

Test #36:

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

input:

997
1
1
2
1
1
2
1
2
1
2
2
2
2
2
2
2
1
2
2
1
1
1
1
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 307
8
2
8
0 636
8
2
8
0 890
8
2
8
1 890
8
0 960
8
2
8
0 137
8
2
8
0 454
8
2
8
1 454
8
0 537
8
2
8
0 184
8
2
8
1 184
8
0 700
8
2
8
0 842
8
2
8
1 842
8
0 213
8
2
8
1 213
8
0 536
8
2
8
1 536
8
0 27
8
2
8
1 27
8
0 13
8
2
8
1 13
8
0 81
8
2
8
1 81
8
0 411
8
2
8
1 411
8
0 974
8
2
8
0 742
8
2
8
1 742
8
...

result:

ok 

Test #37:

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

input:

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

output:

8
0 910
8
2
8
0 641
8
2
8
0 540
8
2
8
0 894
8
2
8
0 924
8
2
8
0 522
8
2
8
0 589
8
2
8
0 97
8
2
8
0 348
8
2
8
0 610
8
2
8
0 25
8
2
8
0 722
8
2
8
1 722
8
0 622
8
2
8
0 606
8
2
8
1 606
8
0 415
8
2
8
0 592
8
2
8
1 592
8
0 454
8
2
8
1 454
8
0 179
8
2
8
0 290
8
2
8
0 621
8
2
8
0 199
8
2
8
1 199
8
0 209
8
...

result:

ok 

Test #38:

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

input:

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

output:

8
0 307
8
2
8
0 636
8
2
8
0 890
8
2
8
0 960
8
2
8
0 137
8
2
8
0 454
8
2
8
1 454
8
0 537
8
2
8
0 184
8
2
8
0 700
8
2
8
0 842
8
2
8
0 213
8
2
8
0 536
8
2
8
0 27
8
2
8
0 13
8
2
8
0 81
8
2
8
0 411
8
2
8
1 411
8
0 974
8
2
8
1 974
8
0 742
8
2
8
0 599
8
2
8
1 599
8
0 278
8
2
8
1 278
8
0 946
8
2
8
0 310
8
2...

result:

ok 

Test #39:

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

input:

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

output:

8
0 307
8
2
8
0 636
8
2
8
0 890
8
2
8
0 960
8
2
8
0 137
8
2
8
0 454
8
2
8
0 537
8
2
8
0 184
8
2
8
0 700
8
2
8
0 842
8
2
8
0 213
8
2
8
0 536
8
2
8
0 27
8
2
8
0 13
8
2
8
0 81
8
2
8
0 411
8
2
8
0 974
8
2
8
1 974
8
0 742
8
2
8
0 599
8
2
8
0 278
8
2
8
0 946
8
2
8
0 310
8
2
8
0 127
8
2
8
0 597
8
2
8
0 131...

result:

ok 

Test #40:

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

input:

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

output:

8
0 668
8
2
8
0 714
8
2
8
0 614
8
2
8
0 199
8
2
8
0 814
8
2
8
0 566
8
2
8
0 142
8
2
8
0 569
8
2
8
0 985
8
2
8
0 931
8
2
8
0 471
8
2
8
0 535
8
2
8
0 516
8
2
8
0 270
8
2
8
1 270
8
0 558
8
2
8
1 558
8
0 617
8
2
8
0 433
8
2
8
0 357
8
2
8
0 396
8
2
8
0 742
8
2
8
0 73
8
2
8
0 131
8
2
8
0 863
8
2
8
1 863
8...

result:

ok 

Test #41:

score: 0
Accepted
time: 3ms
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
2
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
2
1
1
1
1
1
2
1
1
1
1
2
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
2
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
2
1
2
2
1
1
2
1
...

output:

8
0 910
8
2
8
0 641
8
2
8
0 540
8
2
8
0 894
8
2
8
0 924
8
2
8
0 522
8
2
8
0 589
8
2
8
0 97
8
2
8
0 348
8
2
8
0 610
8
2
8
0 25
8
2
8
0 722
8
2
8
0 622
8
2
8
0 606
8
2
8
0 415
8
2
8
0 592
8
2
8
0 454
8
2
8
0 179
8
2
8
0 290
8
2
8
0 621
8
2
8
0 199
8
2
8
0 209
8
2
8
0 303
8
2
8
0 355
8
2
8
0 85
8
2
8
0...

result:

ok 

Test #42:

score: 0
Accepted
time: 10ms
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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
2
1
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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
2
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
...

output:

8
0 910
8
2
8
0 641
8
2
8
0 540
8
2
8
0 894
8
2
8
0 924
8
2
8
0 522
8
2
8
0 589
8
2
8
0 97
8
2
8
0 348
8
2
8
0 610
8
2
8
0 25
8
2
8
0 722
8
2
8
0 622
8
2
8
0 606
8
2
8
0 415
8
2
8
0 592
8
2
8
0 454
8
2
8
0 179
8
2
8
0 290
8
2
8
0 621
8
2
8
0 199
8
2
8
0 209
8
2
8
0 303
8
2
8
0 355
8
2
8
0 85
8
2
8
0...

result:

ok 

Subtask #3:

score: 40.49
Acceptable Answer

Test #43:

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

input:

2
1
2
2

output:

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

result:

ok 

Test #44:

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

input:

2
1
1

output:

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

result:

ok 

Test #45:

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

input:

3
1
2
1
2

output:

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

result:

ok 

Test #46:

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

input:

6
1
2
2
2
2
1
2
3
3
3

output:

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

result:

ok 

Test #47:

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

input:

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

output:

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

result:

ok 

Test #48:

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

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 182
8
2
8
0 682
8
2
8
1 682
8
0 247
8
2
8
1 247
8
0 286
8
2
8
1 286
8
0 204
8
2
8
1 204
8
0 123
8
2
8
1 123
8
0 1315
8
2
8
1 1315
8
0 223
8
2
8
1 223
8
0 79
8
2
8
1 79
8
0 1403
8
2
8
1 1403
8
0 871
8
2
8
1 871
8
0 565
8
2
8
1 565
8
0 790
8
2
8
1 790
8
0 1097
8
2
8
1 1097
8
0 239
8
2
8
1 239
8
0 ...

result:

ok 

Test #49:

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

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 182
8
2
8
0 682
8
2
8
0 247
8
2
8
0 286
8
2
8
0 204
8
2
8
0 123
8
2
8
0 1315
8
2
8
0 223
8
2
8
0 79
8
2
8
0 1403
8
2
8
0 871
8
2
8
0 565
8
2
8
0 790
8
2
8
0 1097
8
2
8
0 239
8
2
8
0 720
8
2
8
0 739
8
2
8
0 891
8
2
8
0 1702
8
2
8
0 1803
8
2
8
0 1009
8
2
8
0 1187
8
2
8
0 218
8
2
8
0 1199
8
2
8
0 3...

result:

ok 

Test #50:

score: 58.59
Acceptable Answer
time: 18ms
memory: 3816kb

input:

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

output:

8
0 182
8
2
8
0 682
8
2
8
0 247
8
2
8
0 286
8
2
8
0 204
8
2
8
0 123
8
2
8
0 1315
8
2
8
0 223
8
2
8
0 79
8
2
8
0 1403
8
2
8
0 871
8
2
8
0 565
8
2
8
0 790
8
2
8
0 1097
8
2
8
1 1097
8
0 239
8
2
8
0 720
8
2
8
0 739
8
2
8
1 739
8
0 891
8
2
8
1 891
8
0 1702
8
2
8
0 1803
8
2
8
1 1803
8
0 1009
8
2
8
0 1187
...

result:

points 0.78120 points  0.78120

Test #51:

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

input:

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

output:

8
0 182
8
2
8
0 682
8
2
8
0 247
8
2
8
0 286
8
2
8
0 204
8
2
8
0 123
8
2
8
0 1315
8
2
8
0 223
8
2
8
0 79
8
2
8
0 1403
8
2
8
0 871
8
2
8
1 871
8
0 565
8
2
8
0 790
8
2
8
1 790
8
0 1097
8
2
8
0 239
8
2
8
1 239
8
0 720
8
2
8
0 739
8
2
8
1 739
8
0 891
8
2
8
0 1702
8
2
8
1 1702
8
0 1803
8
2
8
1 1803
8
0 10...

result:

points 0.82080 points  0.82080

Test #52:

score: 75
Accepted
time: 15ms
memory: 3704kb

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 182
8
2
8
0 682
8
2
8
1 682
8
0 247
8
2
8
1 247
8
0 286
8
2
8
1 286
8
0 204
8
2
8
1 204
8
0 123
8
2
8
1 123
8
0 1315
8
2
8
1 1315
8
0 223
8
2
8
1 223
8
0 79
8
2
8
1 79
8
0 1403
8
2
8
1 1403
8
0 871
8
2
8
1 871
8
0 565
8
2
8
1 565
8
0 790
8
2
8
1 790
8
0 1097
8
2
8
1 1097
8
0 239
8
2
8
1 239
8
0 ...

result:

ok 

Test #53:

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

input:

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

output:

8
0 182
8
2
8
0 682
8
2
8
0 247
8
2
8
1 247
8
0 286
8
2
8
0 204
8
2
8
0 123
8
2
8
1 123
8
0 1315
8
2
8
0 223
8
2
8
0 79
8
2
8
0 1403
8
2
8
0 871
8
2
8
1 871
8
0 565
8
2
8
1 565
8
0 790
8
2
8
1 790
8
0 1097
8
2
8
1 1097
8
0 239
8
2
8
1 239
8
0 720
8
2
8
0 739
8
2
8
0 891
8
2
8
1 891
8
0 1702
8
2
8
1 ...

result:

ok 

Test #54:

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

input:

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

output:

8
0 182
8
2
8
0 682
8
2
8
0 247
8
2
8
1 247
8
0 286
8
2
8
0 204
8
2
8
1 204
8
0 123
8
2
8
1 123
8
0 1315
8
2
8
1 1315
8
0 223
8
2
8
0 79
8
2
8
1 79
8
0 1403
8
2
8
1 1403
8
0 871
8
2
8
1 871
8
0 565
8
2
8
1 565
8
0 790
8
2
8
1 790
8
0 1097
8
2
8
1 1097
8
0 239
8
2
8
1 239
8
0 720
8
2
8
1 720
8
0 739
...

result:

ok 

Test #55:

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

input:

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

output:

8
0 182
8
2
8
0 682
8
2
8
0 247
8
2
8
0 286
8
2
8
0 204
8
2
8
0 123
8
2
8
0 1315
8
2
8
0 223
8
2
8
0 79
8
2
8
0 1403
8
2
8
0 871
8
2
8
1 871
8
0 565
8
2
8
0 790
8
2
8
0 1097
8
2
8
1 1097
8
0 239
8
2
8
0 720
8
2
8
0 739
8
2
8
0 891
8
2
8
0 1702
8
2
8
0 1803
8
2
8
0 1009
8
2
8
1 1009
8
0 1187
8
2
8
1 ...

result:

ok 

Test #56:

score: 63.28
Acceptable Answer
time: 19ms
memory: 3824kb

input:

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

output:

8
0 326
8
2
8
0 373
8
2
8
0 655
8
2
8
0 953
8
2
8
1 953
8
0 119
8
2
8
1 119
8
0 538
8
2
8
0 1348
8
2
8
1 1348
8
0 269
8
2
8
1 269
8
0 1265
8
2
8
1 1265
8
0 295
8
2
8
1 295
8
0 1490
8
2
8
0 70
8
2
8
1 70
8
0 1168
8
2
8
1 1168
8
0 441
8
2
8
1 441
8
0 1427
8
2
8
1 1427
8
0 835
8
2
8
1 835
8
0 512
8
2
8...

result:

points 0.84373333330 points  0.84373333330

Test #57:

score: 40.49
Acceptable Answer
time: 9ms
memory: 4072kb

input:

1999
1
1
2
2
1
1
1
1
2
2
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 93
8
2
8
0 382
8
2
8
0 880
8
2
8
1 880
8
0 649
8
2
8
1 649
8
0 1805
8
2
8
0 1059
8
2
8
0 1695
8
2
8
0 977
8
2
8
0 958
8
2
8
1 958
8
0 1050
8
2
8
1 1050
8
0 23
8
2
8
1 23
8
0 300
8
2
8
1 300
8
0 1305
8
2
8
1 1305
8
0 1175
8
2
8
1 1175
8
0 1989
8
2
8
1 1989
8
0 566
8
2
8
0 1777
8
2
8
1 1777
8
0 22...

result:

points 0.53986666670 points  0.53986666670

Test #58:

score: 52.93
Acceptable Answer
time: 9ms
memory: 4072kb

input:

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

output:

8
0 314
8
2
8
0 1415
8
2
8
0 1575
8
2
8
0 168
8
2
8
0 108
8
2
8
0 434
8
2
8
0 982
8
2
8
1 982
8
0 1666
8
2
8
1 1666
8
0 1347
8
2
8
1 1347
8
0 1734
8
2
8
1 1734
8
0 178
8
2
8
1 178
8
0 292
8
2
8
1 292
8
0 1644
8
2
8
0 1888
8
2
8
1 1888
8
0 1712
8
2
8
1 1712
8
0 141
8
2
8
1 141
8
0 781
8
2
8
1 781
8
0...

result:

points 0.70573333330 points  0.70573333330

Test #59:

score: 55.43
Acceptable Answer
time: 22ms
memory: 3852kb

input:

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

output:

8
0 326
8
2
8
0 373
8
2
8
0 655
8
2
8
1 655
8
0 953
8
2
8
0 119
8
2
8
0 538
8
2
8
1 538
8
0 1348
8
2
8
0 269
8
2
8
1 269
8
0 1265
8
2
8
0 295
8
2
8
1 295
8
0 1490
8
2
8
0 70
8
2
8
1 70
8
0 1168
8
2
8
0 441
8
2
8
0 1427
8
2
8
0 835
8
2
8
1 835
8
0 512
8
2
8
0 1006
8
2
8
1 1006
8
0 1009
8
2
8
1 1009
8...

result:

points 0.73906666670 points  0.73906666670

Test #60:

score: 60.21
Acceptable Answer
time: 19ms
memory: 3820kb

input:

1996
1
1
1
2
1
1
2
1
2
1
2
1
2
2
1
1
1
2
1
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 60
8
2
8
0 707
8
2
8
0 849
8
2
8
0 847
8
2
8
1 847
8
0 1833
8
2
8
0 579
8
2
8
0 1782
8
2
8
1 1782
8
0 1184
8
2
8
0 1106
8
2
8
1 1106
8
0 1838
8
2
8
0 379
8
2
8
1 379
8
0 1416
8
2
8
0 1293
8
2
8
1 1293
8
0 384
8
2
8
1 384
8
0 95
8
2
8
0 94
8
2
8
0 1094
8
2
8
0 554
8
2
8
1 554
8
0 402
8
2
8
0 403
...

result:

points 0.80280 points  0.80280

Test #61:

score: 42.71
Acceptable Answer
time: 34ms
memory: 3896kb

input:

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

output:

8
0 182
8
2
8
0 682
8
2
8
0 247
8
2
8
0 286
8
2
8
0 204
8
2
8
1 204
8
0 123
8
2
8
0 1315
8
2
8
0 223
8
2
8
0 79
8
2
8
0 1403
8
2
8
1 1403
8
0 871
8
2
8
1 871
8
0 565
8
2
8
0 790
8
2
8
0 1097
8
2
8
0 239
8
2
8
1 239
8
0 720
8
2
8
1 720
8
0 739
8
2
8
1 739
8
0 891
8
2
8
0 1702
8
2
8
1 1702
8
0 1803
8
...

result:

points 0.56946666670 points  0.56946666670

Test #62:

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

input:

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

output:

8
0 326
8
2
8
0 373
8
2
8
0 655
8
2
8
0 953
8
2
8
0 119
8
2
8
0 538
8
2
8
0 1348
8
2
8
0 269
8
2
8
0 1265
8
2
8
0 295
8
2
8
1 295
8
0 1490
8
2
8
0 70
8
2
8
0 1168
8
2
8
0 441
8
2
8
1 441
8
0 1427
8
2
8
0 835
8
2
8
1 835
8
0 512
8
2
8
0 1006
8
2
8
0 1009
8
2
8
1 1009
8
0 163
8
2
8
0 283
8
2
8
0 849
8...

result:

points 0.86466666670 points  0.86466666670

Test #63:

score: 67.06
Acceptable Answer
time: 15ms
memory: 3792kb

input:

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

output:

8
0 182
8
2
8
0 682
8
2
8
0 247
8
2
8
0 286
8
2
8
0 204
8
2
8
0 123
8
2
8
0 1315
8
2
8
0 223
8
2
8
0 79
8
2
8
0 1403
8
2
8
0 871
8
2
8
0 565
8
2
8
1 565
8
0 790
8
2
8
0 1097
8
2
8
1 1097
8
0 239
8
2
8
0 720
8
2
8
0 739
8
2
8
1 739
8
0 891
8
2
8
1 891
8
0 1702
8
2
8
0 1803
8
2
8
0 1009
8
2
8
0 1187
8...

result:

points 0.89413333330 points  0.89413333330

Test #64:

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

input:

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

output:

8
0 1562
8
2
8
0 540
8
2
8
0 1297
8
2
8
0 717
8
2
8
0 688
8
2
8
0 601
8
2
8
0 631
8
2
8
0 1265
8
2
8
0 1218
8
2
8
0 1422
8
2
8
0 790
8
2
8
0 1025
8
2
8
0 585
8
2
8
0 787
8
2
8
0 1049
8
2
8
0 420
8
2
8
0 363
8
2
8
0 104
8
2
8
0 460
8
2
8
0 1489
8
2
8
0 1455
8
2
8
0 1611
8
2
8
0 23
8
2
8
0 1291
8
2
8
...

result:

ok 

Test #65:

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

input:

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

output:

8
0 93
8
2
8
0 382
8
2
8
0 880
8
2
8
0 649
8
2
8
0 1805
8
2
8
0 1059
8
2
8
0 1695
8
2
8
0 977
8
2
8
0 958
8
2
8
0 1050
8
2
8
0 23
8
2
8
0 300
8
2
8
1 300
8
0 1305
8
2
8
0 1175
8
2
8
0 1989
8
2
8
0 566
8
2
8
1 566
8
0 1777
8
2
8
0 224
8
2
8
0 104
8
2
8
0 96
8
2
8
0 1649
8
2
8
0 758
8
2
8
0 1617
8
2
8...

result:

ok 

Test #66:

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

input:

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

output:

8
0 326
8
2
8
0 373
8
2
8
0 655
8
2
8
0 953
8
2
8
0 119
8
2
8
0 538
8
2
8
0 1348
8
2
8
0 269
8
2
8
0 1265
8
2
8
0 295
8
2
8
0 1490
8
2
8
0 70
8
2
8
0 1168
8
2
8
0 441
8
2
8
0 1427
8
2
8
0 835
8
2
8
1 835
8
0 512
8
2
8
0 1006
8
2
8
1 1006
8
0 1009
8
2
8
0 163
8
2
8
0 283
8
2
8
0 849
8
2
8
0 554
8
2
8...

result:

ok 

Test #67:

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

input:

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

output:

8
0 93
8
2
8
0 382
8
2
8
0 880
8
2
8
0 649
8
2
8
0 1805
8
2
8
0 1059
8
2
8
0 1695
8
2
8
0 977
8
2
8
0 958
8
2
8
0 1050
8
2
8
0 23
8
2
8
0 300
8
2
8
0 1305
8
2
8
0 1175
8
2
8
0 1989
8
2
8
0 566
8
2
8
0 1777
8
2
8
0 224
8
2
8
0 104
8
2
8
0 96
8
2
8
0 1649
8
2
8
0 758
8
2
8
0 1617
8
2
8
0 406
8
2
8
0 1...

result:

ok 

Test #68:

score: 58
Acceptable Answer
time: 15ms
memory: 4104kb

input:

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

output:

8
0 1203
8
2
8
0 1396
8
2
8
0 828
8
2
8
0 1452
8
2
8
0 1699
8
2
8
0 1001
8
2
8
0 1162
8
2
8
0 1748
8
2
8
0 509
8
2
8
1 509
8
0 575
8
2
8
0 304
8
2
8
0 1124
8
2
8
0 849
8
2
8
1 849
8
0 66
8
2
8
0 740
8
2
8
0 1961
8
2
8
0 1548
8
2
8
1 1548
8
0 199
8
2
8
0 1317
8
2
8
0 326
8
2
8
0 332
8
2
8
1 332
8
0 1...

result:

points 0.77333333330 points  0.77333333330

Test #69:

score: 57.79
Acceptable Answer
time: 22ms
memory: 3896kb

input:

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

output:

8
0 1203
8
2
8
0 1396
8
2
8
0 828
8
2
8
0 1452
8
2
8
0 1699
8
2
8
0 1001
8
2
8
0 1162
8
2
8
0 1748
8
2
8
0 509
8
2
8
1 509
8
0 575
8
2
8
0 304
8
2
8
0 1124
8
2
8
0 849
8
2
8
1 849
8
0 66
8
2
8
0 740
8
2
8
0 1961
8
2
8
0 1548
8
2
8
1 1548
8
0 199
8
2
8
0 1317
8
2
8
0 326
8
2
8
0 332
8
2
8
1 332
8
0 1...

result:

points 0.77053333330 points  0.77053333330

Test #70:

score: 54.7
Acceptable Answer
time: 5ms
memory: 3768kb

input:

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

output:

8
0 1203
8
2
8
0 1396
8
2
8
0 828
8
2
8
0 1452
8
2
8
0 1699
8
2
8
0 1001
8
2
8
0 1162
8
2
8
1 1162
8
0 1748
8
2
8
0 509
8
2
8
1 509
8
0 575
8
2
8
0 304
8
2
8
1 304
8
0 1124
8
2
8
0 849
8
2
8
1 849
8
0 66
8
2
8
1 66
8
0 740
8
2
8
1 740
8
0 1961
8
2
8
0 1548
8
2
8
0 199
8
2
8
0 1317
8
2
8
0 326
8
2
8
...

result:

points 0.72933333330 points  0.72933333330

Test #71:

score: 53.22
Acceptable Answer
time: 7ms
memory: 3816kb

input:

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

output:

8
0 1203
8
2
8
0 1396
8
2
8
0 828
8
2
8
0 1452
8
2
8
0 1699
8
2
8
0 1001
8
2
8
0 1162
8
2
8
1 1162
8
0 1748
8
2
8
0 509
8
2
8
1 509
8
0 575
8
2
8
0 304
8
2
8
1 304
8
0 1124
8
2
8
0 849
8
2
8
1 849
8
0 66
8
2
8
1 66
8
0 740
8
2
8
1 740
8
0 1961
8
2
8
0 1548
8
2
8
0 199
8
2
8
0 1317
8
2
8
0 326
8
2
8
...

result:

points 0.70960 points  0.70960

Test #72:

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

input:

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

output:

8
0 689
8
2
8
0 928
8
2
8
0 150
8
2
8
0 1520
8
2
8
0 1070
8
2
8
0 468
8
2
8
0 657
8
2
8
1 657
8
0 291
8
2
8
1 291
8
0 1393
8
2
8
0 1421
8
2
8
0 1531
8
2
8
0 699
8
2
8
0 925
8
2
8
1 925
8
0 460
8
2
8
0 1000
8
2
8
1 1000
8
0 994
8
2
8
1 994
8
0 734
8
2
8
0 1111
8
2
8
0 87
8
2
8
0 866
8
2
8
1 866
8
0 1...

result:

points 0.93480 points  0.93480

Test #73:

score: 64.89
Acceptable Answer
time: 25ms
memory: 3816kb

input:

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

output:

8
0 689
8
2
8
0 928
8
2
8
0 150
8
2
8
0 1520
8
2
8
0 1070
8
2
8
0 468
8
2
8
0 657
8
2
8
0 291
8
2
8
0 1393
8
2
8
0 1421
8
2
8
0 1531
8
2
8
1 1531
8
0 699
8
2
8
0 925
8
2
8
0 460
8
2
8
0 1000
8
2
8
0 994
8
2
8
1 994
8
0 734
8
2
8
1 734
8
0 1111
8
2
8
0 87
8
2
8
0 866
8
2
8
0 1632
8
2
8
0 472
8
2
8
0 ...

result:

points 0.86520 points  0.86520

Test #74:

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

input:

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

output:

8
0 1222
8
2
8
0 1388
8
2
8
0 397
8
2
8
0 463
8
2
8
0 30
8
2
8
0 865
8
2
8
0 806
8
2
8
0 197
8
2
8
0 699
8
2
8
0 115
8
2
8
1 115
8
0 1954
8
2
8
0 924
8
2
8
1 924
8
0 8
8
2
8
0 1050
8
2
8
0 293
8
2
8
0 588
8
2
8
1 588
8
0 214
8
2
8
1 214
8
0 485
8
2
8
0 1114
8
2
8
0 1717
8
2
8
0 380
8
2
8
0 103
8
2
8...

result:

ok 

Test #75:

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

input:

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

output:

8
0 1222
8
2
8
0 1388
8
2
8
0 397
8
2
8
0 463
8
2
8
0 30
8
2
8
0 865
8
2
8
0 806
8
2
8
0 197
8
2
8
0 699
8
2
8
0 115
8
2
8
1 115
8
0 1954
8
2
8
0 924
8
2
8
1 924
8
0 8
8
2
8
0 1050
8
2
8
0 293
8
2
8
0 588
8
2
8
1 588
8
0 214
8
2
8
1 214
8
0 485
8
2
8
0 1114
8
2
8
0 1717
8
2
8
0 380
8
2
8
0 103
8
2
8...

result:

ok 

Test #76:

score: 59.02
Acceptable Answer
time: 13ms
memory: 3792kb

input:

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

output:

8
0 1082
8
2
8
0 252
8
2
8
0 277
8
2
8
0 616
8
2
8
0 1824
8
2
8
0 1104
8
2
8
0 734
8
2
8
0 1305
8
2
8
0 128
8
2
8
0 1233
8
2
8
0 1257
8
2
8
0 758
8
2
8
0 80
8
2
8
0 1636
8
2
8
0 1329
8
2
8
0 126
8
2
8
0 810
8
2
8
1 810
8
0 934
8
2
8
0 134
8
2
8
0 71
8
2
8
1 71
8
0 1759
8
2
8
1 1759
8
0 762
8
2
8
1 7...

result:

points 0.78693333330 points  0.78693333330

Test #77:

score: 58.83
Acceptable Answer
time: 12ms
memory: 3792kb

input:

1970
1
1
1
1
1
1
2
1
1
1
1
1
2
1
1
2
2
2
1
1
1
1
1
2
2
1
1
2
2
1
2
2
1
2
1
2
2
1
2
1
1
1
2
1
1
2
1
2
2
2
2
2
2
2
1
1
2
2
2
2
1
1
1
1
2
2
2
1
2
1
2
1
2
2
2
1
2
1
2
1
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
1
2
1
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1082
8
2
8
0 252
8
2
8
0 277
8
2
8
0 616
8
2
8
0 1824
8
2
8
0 1104
8
2
8
0 734
8
2
8
1 734
8
0 1305
8
2
8
0 128
8
2
8
0 1233
8
2
8
0 1257
8
2
8
0 758
8
2
8
0 80
8
2
8
1 80
8
0 1636
8
2
8
0 1329
8
2
8
0 126
8
2
8
1 126
8
0 810
8
2
8
1 810
8
0 934
8
2
8
1 934
8
0 134
8
2
8
0 71
8
2
8
0 1759
8
2
8
...

result:

points 0.78440 points  0.78440

Test #78:

score: 67.23
Acceptable Answer
time: 18ms
memory: 3900kb

input:

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

output:

8
0 1171
8
2
8
0 762
8
2
8
0 1154
8
2
8
0 472
8
2
8
0 1801
8
2
8
0 215
8
2
8
0 24
8
2
8
0 1205
8
2
8
0 258
8
2
8
0 1770
8
2
8
1 1770
8
0 475
8
2
8
0 905
8
2
8
0 1592
8
2
8
0 204
8
2
8
0 1969
8
2
8
1 1969
8
0 773
8
2
8
0 1005
8
2
8
0 753
8
2
8
0 226
8
2
8
0 23
8
2
8
0 1034
8
2
8
1 1034
8
0 861
8
2
8
...

result:

points 0.89640 points  0.89640

Test #79:

score: 67.08
Acceptable Answer
time: 10ms
memory: 4112kb

input:

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

output:

8
0 1171
8
2
8
0 762
8
2
8
0 1154
8
2
8
0 472
8
2
8
0 1801
8
2
8
0 215
8
2
8
0 24
8
2
8
0 1205
8
2
8
0 258
8
2
8
0 1770
8
2
8
1 1770
8
0 475
8
2
8
0 905
8
2
8
0 1592
8
2
8
0 204
8
2
8
0 1969
8
2
8
0 773
8
2
8
0 1005
8
2
8
0 753
8
2
8
0 226
8
2
8
0 23
8
2
8
0 1034
8
2
8
1 1034
8
0 861
8
2
8
0 1943
8
...

result:

points 0.89440 points  0.89440

Test #80:

score: 64.93
Acceptable Answer
time: 24ms
memory: 3852kb

input:

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

output:

8
0 182
8
2
8
0 682
8
2
8
0 247
8
2
8
0 286
8
2
8
0 204
8
2
8
0 123
8
2
8
0 1315
8
2
8
0 223
8
2
8
0 79
8
2
8
0 1403
8
2
8
0 871
8
2
8
1 871
8
0 565
8
2
8
1 565
8
0 790
8
2
8
0 1097
8
2
8
0 239
8
2
8
0 720
8
2
8
0 739
8
2
8
0 891
8
2
8
0 1702
8
2
8
0 1803
8
2
8
0 1009
8
2
8
0 1187
8
2
8
0 218
8
2
8
...

result:

points 0.86573333330 points  0.86573333330

Test #81:

score: 64.74
Acceptable Answer
time: 8ms
memory: 3816kb

input:

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

output:

8
0 182
8
2
8
0 682
8
2
8
0 247
8
2
8
0 286
8
2
8
0 204
8
2
8
0 123
8
2
8
0 1315
8
2
8
0 223
8
2
8
0 79
8
2
8
0 1403
8
2
8
0 871
8
2
8
1 871
8
0 565
8
2
8
1 565
8
0 790
8
2
8
0 1097
8
2
8
0 239
8
2
8
0 720
8
2
8
0 739
8
2
8
0 891
8
2
8
0 1702
8
2
8
0 1803
8
2
8
0 1009
8
2
8
0 1187
8
2
8
0 218
8
2
8
...

result:

points 0.86320 points  0.86320

Test #82:

score: 55.55
Acceptable Answer
time: 27ms
memory: 3828kb

input:

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

output:

8
0 182
8
2
8
0 682
8
2
8
0 247
8
2
8
0 286
8
2
8
0 204
8
2
8
0 123
8
2
8
0 1315
8
2
8
0 223
8
2
8
1 223
8
0 79
8
2
8
0 1403
8
2
8
0 871
8
2
8
0 565
8
2
8
0 790
8
2
8
0 1097
8
2
8
0 239
8
2
8
0 720
8
2
8
0 739
8
2
8
0 891
8
2
8
0 1702
8
2
8
1 1702
8
0 1803
8
2
8
0 1009
8
2
8
0 1187
8
2
8
0 218
8
2
8...

result:

points 0.74066666670 points  0.74066666670

Test #83:

score: 57.86
Acceptable Answer
time: 18ms
memory: 3816kb

input:

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

output:

8
0 182
8
2
8
0 682
8
2
8
0 247
8
2
8
0 286
8
2
8
0 204
8
2
8
0 123
8
2
8
0 1315
8
2
8
0 223
8
2
8
0 79
8
2
8
0 1403
8
2
8
0 871
8
2
8
0 565
8
2
8
0 790
8
2
8
0 1097
8
2
8
0 239
8
2
8
1 239
8
0 720
8
2
8
0 739
8
2
8
1 739
8
0 891
8
2
8
1 891
8
0 1702
8
2
8
0 1803
8
2
8
0 1009
8
2
8
0 1187
8
2
8
0 21...

result:

points 0.77146666670 points  0.77146666670

Test #84:

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

input:

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

output:

8
0 262
8
2
8
0 402
8
2
8
1 402
8
0 434
8
2
8
1 434
8
0 427
8
2
8
1 427
8
0 476
8
2
8
1 476
8
0 271
8
2
8
1 271
8
0 401
8
2
8
1 401
8
0 485
8
2
8
0 219
8
2
8
1 219
8
0 22
8
2
8
1 22
8
0 295
8
2
8
1 295
8
0 65
8
2
8
1 65
8
0 318
8
2
8
1 318
8
0 375
8
2
8
1 375
8
0 239
8
2
8
1 239
8
0 134
8
2
8
1 134
...

result:

ok 

Test #85:

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

input:

1834
1
1
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 301
8
2
8
0 1459
8
2
8
0 304
8
2
8
1 304
8
0 1111
8
2
8
1 1111
8
0 1493
8
2
8
1 1493
8
0 1091
8
2
8
1 1091
8
0 1598
8
2
8
1 1598
8
0 565
8
2
8
1 565
8
0 868
8
2
8
1 868
8
0 781
8
2
8
0 1385
8
2
8
1 1385
8
0 597
8
2
8
1 597
8
0 1115
8
2
8
1 1115
8
0 1484
8
2
8
1 1484
8
0 1427
8
2
8
1 1427
8
0 159...

result:

ok 

Test #86:

score: 72.67
Acceptable Answer
time: 11ms
memory: 3764kb

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 182
8
2
8
0 682
8
2
8
1 682
8
0 247
8
2
8
1 247
8
0 286
8
2
8
0 204
8
2
8
1 204
8
0 123
8
2
8
1 123
8
0 1315
8
2
8
1 1315
8
0 223
8
2
8
1 223
8
0 79
8
2
8
1 79
8
0 1403
8
2
8
1 1403
8
0 871
8
2
8
1 871
8
0 565
8
2
8
1 565
8
0 790
8
2
8
1 790
8
0 1097
8
2
8
1 1097
8
0 239
8
2
8
1 239
8
0 720
8
2
...

result:

points 0.96893333330 points  0.96893333330

Test #87:

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

input:

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

output:

8
0 182
8
2
8
0 682
8
2
8
1 682
8
0 247
8
2
8
1 247
8
0 286
8
2
8
1 286
8
0 204
8
2
8
1 204
8
0 123
8
2
8
1 123
8
0 1315
8
2
8
0 223
8
2
8
1 223
8
0 79
8
2
8
1 79
8
0 1403
8
2
8
0 871
8
2
8
1 871
8
0 565
8
2
8
1 565
8
0 790
8
2
8
1 790
8
0 1097
8
2
8
0 239
8
2
8
1 239
8
0 720
8
2
8
1 720
8
0 739
8
2...

result:

ok 

Test #88:

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

input:

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

output:

8
0 182
8
2
8
0 682
8
2
8
0 247
8
2
8
0 286
8
2
8
0 204
8
2
8
0 123
8
2
8
0 1315
8
2
8
0 223
8
2
8
0 79
8
2
8
0 1403
8
2
8
1 1403
8
0 871
8
2
8
0 565
8
2
8
0 790
8
2
8
0 1097
8
2
8
1 1097
8
0 239
8
2
8
0 720
8
2
8
0 739
8
2
8
0 891
8
2
8
0 1702
8
2
8
1 1702
8
0 1803
8
2
8
1 1803
8
0 1009
8
2
8
1 100...

result:

ok 

Test #89:

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

input:

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

output:

8
0 182
8
2
8
0 682
8
2
8
0 247
8
2
8
1 247
8
0 286
8
2
8
1 286
8
0 204
8
2
8
1 204
8
0 123
8
2
8
1 123
8
0 1315
8
2
8
0 223
8
2
8
1 223
8
0 79
8
2
8
1 79
8
0 1403
8
2
8
0 871
8
2
8
0 565
8
2
8
0 790
8
2
8
0 1097
8
2
8
0 239
8
2
8
1 239
8
0 720
8
2
8
0 739
8
2
8
0 891
8
2
8
0 1702
8
2
8
1 1702
8
0 1...

result:

ok