QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#143308#4565. Rarest Insectsbashkort54.77 57ms3844kbC++204.0kb2023-08-21 01:42:462023-08-21 01:42:50

Judging History

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

  • [2023-08-21 01:42:50]
  • 评测
  • 测评结果:54.77
  • 用时:57ms
  • 内存:3844kb
  • [2023-08-21 01:42:46]
  • 提交

answer

#include "insects.h"
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

mt19937 rnd(228);

int min_cardinality(int N) {
    vector<int> a(N);
    iota(a.begin(), a.end(), 0);

    for (int t = 0; t < 3; ++t) {
        for (int i = 0; i < N; ++i) {
            swap(a[i], a[rnd() % N]);
        }
    }

    vector<int> leaders, inside(N);
    int maxSize = 0, T = 0, cntIn = 0, lastQueryT = 0;
    int queriesCnt[3]{};

    auto insert = [&](int x) -> bool {
        if (inside[x]) {
            return false;
        }
        cntIn += 1;
        move_inside(x);
        T += 1;
        queriesCnt[0] += 1;
        inside[x] = true;
        return true;
    };

    auto erase = [&](int x) -> bool {
        if (!inside[x]) {
            return false;
        }
        cntIn -= 1;
        move_outside(x);
        T += 1;
        queriesCnt[1] += 1;
        inside[x] = false;
        return true;
    };

    auto query = [&]() -> int {
        if (T == lastQueryT) {
            return maxSize;
        }
        lastQueryT = T;
        queriesCnt[2] += 1;
        return maxSize = press_button();
    };

    vector<int> others;

    for (int x : a) {
        insert(x);
        if (query() == 1) {
            leaders.push_back(x);
        } else {
            others.push_back(x);
            erase(x);
        }
    };


    int ans = N;
    if (size(leaders) > size(others)) {
        return 1;
    } else if (size(leaders) == 1) {
        return N;
    }

    if (0) {
        shuffle(leaders.begin(), leaders.end(), rnd);
        auto dfs = [&](auto dfs, vector<int> lead, vector<int> oth, int isFull) -> void {
            if (ans == 1) {
                return;
            }
            if (size(lead) == 1) {
                ans = min<int>(ans, 1 + size(oth));
                return;
            }
            if (size(lead) > size(oth)) {
                ans = 1;
                return;
            }
            int mid = size(lead) / 2;
            vector<int> leadLeft(lead.begin(), lead.begin() + mid);
            vector<int> leadRight(lead.begin() + mid, lead.end());
            vector<int> nxt[2];
            if (isFull) {
                for (int x: leadRight) {
                    erase(x);
                }
            } else {
                for (int x: leadLeft) {
                    insert(x);
                }
            }
            for (int x: oth) {
                insert(x);
                if (query() == 1) {
                    nxt[1].push_back(x);
                } else {
                    nxt[0].push_back(x);
                }
                erase(x);
            }
            dfs(dfs, leadLeft, nxt[0], true);
            dfs(dfs, leadRight, nxt[1], false);
        };

        dfs(dfs, leaders, others, true);
        return ans;
    } else {
        shuffle(others.begin(), others.end(), rnd);
        int lo = 1, hi = 2 + size(others) / size(leaders);
        while (lo + 1 < hi) {
            int mid = lo + hi >> 1;
            if (query() > mid) {
                for (int x : others) {
                    erase(x);
                }
            }
            bool yay = size(leaders) * mid == cntIn;
            if (!yay) {
                int left = size(others) + size(leaders) - cntIn;
                for (int x : others) {
                    if (insert(x)) {
                        left -= 1;
                        if (query() > mid) {
                            erase(x);
                        }
                        if (size(leaders) * mid == cntIn) {
                            yay = true;
                            break;
                        } else if (size(leaders) * mid > cntIn + left) {
                            break;
                        }
                    }
                }
            }
            if (yay) {
                lo = mid;
            } else {
                hi = mid;
            }
        }
        return lo;
    }
}


詳細信息

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

6
1
1
2
1
2
2
1
2
2
3

output:

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

input:

2
1
2

output:

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

result:

ok 

Test #3:

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

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: 2ms
memory: 3692kb

input:

3
1
1
2

output:

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

result:

ok 

Test #5:

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

input:

5
1
2
2
1
2
1
2
3
2

output:

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

result:

ok 

Test #6:

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

input:

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

output:

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

result:

ok 

Test #7:

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

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 8
8
2
8
0 144
8
2
8
1 144
8
0 70
8
2
8
1 70
8
0 39
8
2
8
1 39
8
0 168
8
2
8
1 168
8
0 89
8
2
8
1 89
8
0 35
8
2
8
1 35
8
0 51
8
2
8
1 51
8
0 52
8
2
8
1 52
8
0 47
8
2
8
1 47
8
0 156
8
2
8
1 156
8
0 147
8
2
8
1 147
8
0 30
8
2
8
1 30
8
0 79
8
2
8
1 79
8
0 142
8
2
8
1 142
8
0 4
8
2
8
1 4
8
0 121
8
2
...

result:

ok 

Test #8:

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

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 49
8
2
8
0 158
8
2
8
0 132
8
2
8
0 45
8
2
8
0 103
8
2
8
0 162
8
2
8
0 28
8
2
8
0 184
8
2
8
0 120
8
2
8
0 199
8
2
8
0 163
8
2
8
0 164
8
2
8
0 56
8
2
8
0 25
8
2
8
0 51
8
2
8
0 14
8
2
8
0 147
8
2
8
0 114
8
2
8
0 151
8
2
8
0 86
8
2
8
0 181
8
2
8
0 30
8
2
8
0 192
8
2
8
0 169
8
2
8
0 18
8
2
8
0 22
8
2...

result:

ok 

Test #9:

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

input:

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

output:

8
0 49
8
2
8
0 158
8
2
8
0 132
8
2
8
0 45
8
2
8
0 103
8
2
8
1 103
8
0 162
8
2
8
1 162
8
0 28
8
2
8
1 28
8
0 184
8
2
8
0 120
8
2
8
0 199
8
2
8
1 199
8
0 163
8
2
8
0 164
8
2
8
0 56
8
2
8
0 25
8
2
8
0 51
8
2
8
0 14
8
2
8
0 147
8
2
8
1 147
8
0 114
8
2
8
1 114
8
0 151
8
2
8
1 151
8
0 86
8
2
8
1 86
8
0 18...

result:

ok 

Test #10:

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

input:

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

output:

8
0 7
8
2
8
0 137
8
2
8
0 112
8
2
8
0 154
8
2
8
1 154
8
0 87
8
2
8
0 125
8
2
8
0 36
8
2
8
0 184
8
2
8
0 175
8
2
8
0 80
8
2
8
1 80
8
0 146
8
2
8
1 146
8
0 119
8
2
8
1 119
8
0 163
8
2
8
0 176
8
2
8
0 156
8
2
8
1 156
8
0 155
8
2
8
1 155
8
0 95
8
2
8
0 170
8
2
8
0 111
8
2
8
0 116
8
2
8
1 116
8
0 188
8
2...

result:

ok 

Test #11:

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

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
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 8
8
2
8
0 144
8
2
8
1 144
8
0 70
8
2
8
1 70
8
0 39
8
2
8
1 39
8
0 168
8
2
8
1 168
8
0 89
8
2
8
1 89
8
0 35
8
2
8
1 35
8
0 51
8
2
8
1 51
8
0 52
8
2
8
1 52
8
0 47
8
2
8
1 47
8
0 156
8
2
8
1 156
8
0 147
8
2
8
1 147
8
0 30
8
2
8
1 30
8
0 79
8
2
8
1 79
8
0 142
8
2
8
1 142
8
0 4
8
2
8
1 4
8
0 121
8
2
...

result:

ok 

Test #12:

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

input:

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

output:

8
0 182
8
2
8
0 34
8
2
8
1 34
8
0 10
8
2
8
0 162
8
2
8
0 186
8
2
8
0 134
8
2
8
0 168
8
2
8
0 91
8
2
8
1 91
8
0 125
8
2
8
0 64
8
2
8
0 171
8
2
8
0 98
8
2
8
0 126
8
2
8
1 126
8
0 23
8
2
8
0 61
8
2
8
1 61
8
0 172
8
2
8
0 88
8
2
8
0 76
8
2
8
1 76
8
0 29
8
2
8
1 29
8
0 59
8
2
8
1 59
8
0 89
8
2
8
1 89
8
0...

result:

ok 

Test #13:

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

input:

197
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 34
8
2
8
0 10
8
2
8
1 10
8
0 162
8
2
8
1 162
8
0 186
8
2
8
0 134
8
2
8
0 168
8
2
8
1 168
8
0 91
8
2
8
1 91
8
0 125
8
2
8
0 64
8
2
8
1 64
8
0 171
8
2
8
1 171
8
0 98
8
2
8
1 98
8
0 126
8
2
8
1 126
8
0 23
8
2
8
1 23
8
0 61
8
2
8
1 61
8
0 172
8
2
8
1 172
8
0 88
8
2
8
1 88
8
0 76
8
2
8
1 ...

result:

ok 

Test #14:

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

input:

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

output:

8
0 7
8
2
8
0 137
8
2
8
0 112
8
2
8
0 154
8
2
8
0 87
8
2
8
0 125
8
2
8
1 125
8
0 36
8
2
8
0 184
8
2
8
0 175
8
2
8
0 80
8
2
8
1 80
8
0 146
8
2
8
0 119
8
2
8
1 119
8
0 163
8
2
8
1 163
8
0 176
8
2
8
1 176
8
0 156
8
2
8
0 155
8
2
8
1 155
8
0 95
8
2
8
1 95
8
0 170
8
2
8
0 111
8
2
8
1 111
8
0 116
8
2
8
1 ...

result:

ok 

Test #15:

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

input:

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

output:

8
0 49
8
2
8
0 158
8
2
8
0 132
8
2
8
1 132
8
0 45
8
2
8
0 103
8
2
8
1 103
8
0 162
8
2
8
1 162
8
0 28
8
2
8
1 28
8
0 184
8
2
8
0 120
8
2
8
1 120
8
0 199
8
2
8
1 199
8
0 163
8
2
8
1 163
8
0 164
8
2
8
1 164
8
0 56
8
2
8
1 56
8
0 25
8
2
8
0 51
8
2
8
1 51
8
0 14
8
2
8
1 14
8
0 147
8
2
8
1 147
8
0 114
8
2...

result:

ok 

Test #16:

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

input:

196
1
1
1
2
1
1
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 104
8
2
8
0 25
8
2
8
0 17
8
2
8
0 158
8
2
8
1 158
8
0 41
8
2
8
0 46
8
2
8
0 69
8
2
8
1 69
8
0 190
8
2
8
0 30
8
2
8
1 30
8
0 72
8
2
8
1 72
8
0 92
8
2
8
1 92
8
0 77
8
2
8
0 36
8
2
8
1 36
8
0 187
8
2
8
1 187
8
0 154
8
2
8
1 154
8
0 159
8
2
8
1 159
8
0 23
8
2
8
1 23
8
0 132
8
2
8
1 132
8
0 166
8
2
8...

result:

ok 

Test #17:

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

input:

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

output:

8
0 8
8
2
8
0 144
8
2
8
1 144
8
0 70
8
2
8
0 39
8
2
8
0 168
8
2
8
0 89
8
2
8
1 89
8
0 35
8
2
8
0 51
8
2
8
1 51
8
0 52
8
2
8
0 47
8
2
8
1 47
8
0 156
8
2
8
0 147
8
2
8
1 147
8
0 30
8
2
8
1 30
8
0 79
8
2
8
0 142
8
2
8
0 4
8
2
8
1 4
8
0 121
8
2
8
1 121
8
0 26
8
2
8
1 26
8
0 194
8
2
8
1 194
8
0 13
8
2
8
...

result:

ok 

Test #18:

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

input:

196
1
1
1
1
2
1
1
2
1
1
2
2
1
2
2
2
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 104
8
2
8
0 25
8
2
8
0 17
8
2
8
0 158
8
2
8
0 41
8
2
8
1 41
8
0 46
8
2
8
0 69
8
2
8
0 190
8
2
8
1 190
8
0 30
8
2
8
0 72
8
2
8
0 92
8
2
8
1 92
8
0 77
8
2
8
1 77
8
0 36
8
2
8
0 187
8
2
8
1 187
8
0 154
8
2
8
1 154
8
0 159
8
2
8
1 159
8
0 23
8
2
8
1 23
8
0 132
8
2
8
1 132
8
0 166
8
2
8
0 57
8
2
8
1 ...

result:

ok 

Test #19:

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

input:

196
1
1
1
1
1
2
2
1
1
1
1
1
2
2
2
2
2
1
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
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 104
8
2
8
0 25
8
2
8
0 17
8
2
8
0 158
8
2
8
0 41
8
2
8
0 46
8
2
8
1 46
8
0 69
8
2
8
1 69
8
0 190
8
2
8
0 30
8
2
8
0 72
8
2
8
0 92
8
2
8
0 77
8
2
8
0 36
8
2
8
1 36
8
0 187
8
2
8
1 187
8
0 154
8
2
8
1 154
8
0 159
8
2
8
1 159
8
0 23
8
2
8
1 23
8
0 132
8
2
8
0 166
8
2
8
1 166
8
0 57
8
2
8
1 57
8
0 1...

result:

ok 

Test #20:

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

input:

196
1
1
1
2
2
1
1
1
1
1
1
1
2
1
1
2
2
1
2
2
2
1
2
2
2
1
2
2
2
2
2
2
1
2
1
2
2
2
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 104
8
2
8
0 25
8
2
8
0 17
8
2
8
0 158
8
2
8
1 158
8
0 41
8
2
8
1 41
8
0 46
8
2
8
0 69
8
2
8
0 190
8
2
8
0 30
8
2
8
0 72
8
2
8
0 92
8
2
8
0 77
8
2
8
0 36
8
2
8
1 36
8
0 187
8
2
8
0 154
8
2
8
0 159
8
2
8
1 159
8
0 23
8
2
8
1 23
8
0 132
8
2
8
0 166
8
2
8
1 166
8
0 57
8
2
8
1 57
8
0 111
8
2
8
1 111
...

result:

ok 

Test #21:

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

input:

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

output:

8
0 49
8
2
8
0 158
8
2
8
0 132
8
2
8
0 45
8
2
8
0 103
8
2
8
0 162
8
2
8
0 28
8
2
8
0 184
8
2
8
1 184
8
0 120
8
2
8
0 199
8
2
8
0 163
8
2
8
0 164
8
2
8
1 164
8
0 56
8
2
8
0 25
8
2
8
1 25
8
0 51
8
2
8
0 14
8
2
8
0 147
8
2
8
0 114
8
2
8
1 114
8
0 151
8
2
8
0 86
8
2
8
0 181
8
2
8
1 181
8
0 30
8
2
8
1 30...

result:

ok 

Test #22:

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

input:

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

output:

8
0 8
8
2
8
0 144
8
2
8
0 70
8
2
8
0 39
8
2
8
0 168
8
2
8
0 89
8
2
8
0 35
8
2
8
0 51
8
2
8
0 52
8
2
8
0 47
8
2
8
0 156
8
2
8
0 147
8
2
8
0 30
8
2
8
0 79
8
2
8
0 142
8
2
8
0 4
8
2
8
0 121
8
2
8
1 121
8
0 26
8
2
8
0 194
8
2
8
0 13
8
2
8
0 31
8
2
8
0 181
8
2
8
0 72
8
2
8
0 54
8
2
8
0 173
8
2
8
0 158
8
...

result:

ok 

Test #23:

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

input:

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

output:

8
0 7
8
2
8
0 137
8
2
8
0 112
8
2
8
0 154
8
2
8
0 87
8
2
8
0 125
8
2
8
0 36
8
2
8
0 184
8
2
8
0 175
8
2
8
0 80
8
2
8
0 146
8
2
8
0 119
8
2
8
0 163
8
2
8
0 176
8
2
8
1 176
8
0 156
8
2
8
0 155
8
2
8
0 95
8
2
8
0 170
8
2
8
0 111
8
2
8
0 116
8
2
8
0 188
8
2
8
1 188
8
0 74
8
2
8
0 138
8
2
8
0 196
8
2
8
0...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

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

input:

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

output:

8
0 385
8
2
8
0 295
8
2
8
1 295
8
0 969
8
2
8
1 969
8
0 69
8
2
8
1 69
8
0 942
8
2
8
1 942
8
0 485
8
2
8
1 485
8
0 152
8
2
8
1 152
8
0 646
8
2
8
1 646
8
0 861
8
2
8
1 861
8
0 277
8
2
8
1 277
8
0 416
8
2
8
1 416
8
0 705
8
2
8
1 705
8
0 55
8
2
8
1 55
8
0 466
8
2
8
1 466
8
0 377
8
2
8
1 377
8
0 799
8
2
...

result:

ok 

Test #25:

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

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 385
8
2
8
0 295
8
2
8
0 969
8
2
8
0 69
8
2
8
0 942
8
2
8
0 485
8
2
8
0 152
8
2
8
0 646
8
2
8
0 861
8
2
8
0 277
8
2
8
0 416
8
2
8
0 705
8
2
8
0 55
8
2
8
0 466
8
2
8
0 377
8
2
8
0 799
8
2
8
0 867
8
2
8
0 108
8
2
8
0 717
8
2
8
0 560
8
2
8
0 403
8
2
8
0 709
8
2
8
0 236
8
2
8
0 492
8
2
8
0 283
8
2
8
...

result:

ok 

Test #26:

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

input:

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

output:

8
0 678
8
2
8
0 932
8
2
8
0 805
8
2
8
0 268
8
2
8
0 579
8
2
8
0 55
8
2
8
0 646
8
2
8
1 646
8
0 723
8
2
8
0 58
8
2
8
0 165
8
2
8
0 970
8
2
8
0 86
8
2
8
1 86
8
0 976
8
2
8
0 995
8
2
8
0 208
8
2
8
0 496
8
2
8
0 409
8
2
8
1 409
8
0 667
8
2
8
0 830
8
2
8
1 830
8
0 882
8
2
8
0 87
8
2
8
1 87
8
0 229
8
2
8
...

result:

ok 

Test #27:

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

input:

999
1
1
1
1
2
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
2
1
2
1
2
1
2
2
2
1
2
2
2
2
2
1
2
1
2
2
1
2
2
2
2
2
2
2
2
1
2
1
2
2
2
1
2
2
1
2
2
2
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 678
8
2
8
0 932
8
2
8
0 805
8
2
8
0 268
8
2
8
0 579
8
2
8
1 579
8
0 55
8
2
8
0 646
8
2
8
0 723
8
2
8
0 58
8
2
8
0 165
8
2
8
0 970
8
2
8
1 970
8
0 86
8
2
8
0 976
8
2
8
0 995
8
2
8
0 208
8
2
8
0 496
8
2
8
0 409
8
2
8
0 667
8
2
8
0 830
8
2
8
1 830
8
0 882
8
2
8
0 87
8
2
8
1 87
8
0 229
8
2
8
0 223
8...

result:

ok 

Test #28:

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

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 448
8
2
8
0 119
8
2
8
1 119
8
0 955
8
2
8
1 955
8
0 466
8
2
8
1 466
8
0 212
8
2
8
1 212
8
0 993
8
2
8
1 993
8
0 655
8
2
8
1 655
8
0 381
8
2
8
1 381
8
0 500
8
2
8
1 500
8
0 298
8
2
8
1 298
8
0 738
8
2
8
1 738
8
0 115
8
2
8
1 115
8
0 397
8
2
8
1 397
8
0 779
8
2
8
1 779
8
0 863
8
2
8
1 863
8
0 517
...

result:

ok 

Test #29:

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

input:

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

output:

8
0 805
8
2
8
0 74
8
2
8
0 447
8
2
8
0 548
8
2
8
0 798
8
2
8
1 798
8
0 307
8
2
8
0 66
8
2
8
1 66
8
0 958
8
2
8
0 168
8
2
8
0 292
8
2
8
0 562
8
2
8
1 562
8
0 538
8
2
8
0 45
8
2
8
0 637
8
2
8
1 637
8
0 13
8
2
8
0 778
8
2
8
1 778
8
0 178
8
2
8
0 525
8
2
8
0 220
8
2
8
1 220
8
0 759
8
2
8
1 759
8
0 729
8...

result:

ok 

Test #30:

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

input:

998
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 67
8
2
8
0 385
8
2
8
1 385
8
0 762
8
2
8
1 762
8
0 148
8
2
8
0 200
8
2
8
0 479
8
2
8
1 479
8
0 799
8
2
8
1 799
8
0 858
8
2
8
1 858
8
0 412
8
2
8
1 412
8
0 705
8
2
8
1 705
8
0 486
8
2
8
1 486
8
0 803
8
2
8
1 803
8
0 198
8
2
8
1 198
8
0 683
8
2
8
0 948
8
2
8
1 948
8
0 241
8
2
8
0 655
8
2
8
1 655
8...

result:

ok 

Test #31:

score: 0
Accepted
time: 35ms
memory: 3716kb

input:

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

output:

8
0 67
8
2
8
0 385
8
2
8
0 762
8
2
8
0 148
8
2
8
1 148
8
0 200
8
2
8
0 479
8
2
8
0 799
8
2
8
0 858
8
2
8
0 412
8
2
8
0 705
8
2
8
0 486
8
2
8
1 486
8
0 803
8
2
8
0 198
8
2
8
0 683
8
2
8
0 948
8
2
8
0 241
8
2
8
0 655
8
2
8
0 313
8
2
8
1 313
8
0 891
8
2
8
1 891
8
0 746
8
2
8
0 638
8
2
8
1 638
8
0 190
8...

result:

ok 

Test #32:

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

input:

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

output:

8
0 385
8
2
8
0 295
8
2
8
0 969
8
2
8
0 69
8
2
8
0 942
8
2
8
1 942
8
0 485
8
2
8
1 485
8
0 152
8
2
8
1 152
8
0 646
8
2
8
1 646
8
0 861
8
2
8
1 861
8
0 277
8
2
8
1 277
8
0 416
8
2
8
1 416
8
0 705
8
2
8
1 705
8
0 55
8
2
8
1 55
8
0 466
8
2
8
1 466
8
0 377
8
2
8
1 377
8
0 799
8
2
8
1 799
8
0 867
8
2
8
1...

result:

ok 

Test #33:

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

input:

996
1
1
1
2
2
1
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 448
8
2
8
0 119
8
2
8
0 955
8
2
8
0 466
8
2
8
1 466
8
0 212
8
2
8
1 212
8
0 993
8
2
8
0 655
8
2
8
1 655
8
0 381
8
2
8
0 500
8
2
8
0 298
8
2
8
1 298
8
0 738
8
2
8
1 738
8
0 115
8
2
8
1 115
8
0 397
8
2
8
1 397
8
0 779
8
2
8
0 863
8
2
8
1 863
8
0 517
8
2
8
1 517
8
0 549
8
2
8
1 549
8
0 962
8
2
8
1 ...

result:

ok 

Test #34:

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

input:

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

output:

8
0 385
8
2
8
0 295
8
2
8
0 969
8
2
8
1 969
8
0 69
8
2
8
0 942
8
2
8
1 942
8
0 485
8
2
8
0 152
8
2
8
0 646
8
2
8
0 861
8
2
8
1 861
8
0 277
8
2
8
1 277
8
0 416
8
2
8
0 705
8
2
8
1 705
8
0 55
8
2
8
1 55
8
0 466
8
2
8
1 466
8
0 377
8
2
8
1 377
8
0 799
8
2
8
1 799
8
0 867
8
2
8
1 867
8
0 108
8
2
8
1 108...

result:

ok 

Test #35:

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

input:

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

output:

8
0 385
8
2
8
0 295
8
2
8
0 969
8
2
8
1 969
8
0 69
8
2
8
0 942
8
2
8
1 942
8
0 485
8
2
8
0 152
8
2
8
0 646
8
2
8
1 646
8
0 861
8
2
8
1 861
8
0 277
8
2
8
0 416
8
2
8
1 416
8
0 705
8
2
8
1 705
8
0 55
8
2
8
1 55
8
0 466
8
2
8
0 377
8
2
8
1 377
8
0 799
8
2
8
1 799
8
0 867
8
2
8
0 108
8
2
8
1 108
8
0 717...

result:

ok 

Test #36:

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

input:

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

output:

8
0 742
8
2
8
0 804
8
2
8
0 863
8
2
8
0 440
8
2
8
0 78
8
2
8
1 78
8
0 12
8
2
8
0 210
8
2
8
0 378
8
2
8
0 831
8
2
8
1 831
8
0 780
8
2
8
1 780
8
0 449
8
2
8
1 449
8
0 633
8
2
8
0 622
8
2
8
0 767
8
2
8
1 767
8
0 903
8
2
8
1 903
8
0 213
8
2
8
1 213
8
0 92
8
2
8
0 762
8
2
8
0 733
8
2
8
1 733
8
0 389
8
2
...

result:

ok 

Test #37:

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

input:

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

output:

8
0 805
8
2
8
0 74
8
2
8
0 447
8
2
8
0 548
8
2
8
0 798
8
2
8
0 307
8
2
8
1 307
8
0 66
8
2
8
0 958
8
2
8
1 958
8
0 168
8
2
8
0 292
8
2
8
0 562
8
2
8
1 562
8
0 538
8
2
8
1 538
8
0 45
8
2
8
1 45
8
0 637
8
2
8
0 13
8
2
8
0 778
8
2
8
1 778
8
0 178
8
2
8
0 525
8
2
8
1 525
8
0 220
8
2
8
1 220
8
0 759
8
2
8...

result:

ok 

Test #38:

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

input:

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

output:

8
0 742
8
2
8
0 804
8
2
8
0 863
8
2
8
0 440
8
2
8
0 78
8
2
8
0 12
8
2
8
0 210
8
2
8
0 378
8
2
8
0 831
8
2
8
0 780
8
2
8
0 449
8
2
8
0 633
8
2
8
0 622
8
2
8
1 622
8
0 767
8
2
8
1 767
8
0 903
8
2
8
0 213
8
2
8
1 213
8
0 92
8
2
8
0 762
8
2
8
1 762
8
0 733
8
2
8
0 389
8
2
8
0 377
8
2
8
0 934
8
2
8
1 934...

result:

ok 

Test #39:

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

input:

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

output:

8
0 742
8
2
8
0 804
8
2
8
0 863
8
2
8
0 440
8
2
8
0 78
8
2
8
0 12
8
2
8
0 210
8
2
8
0 378
8
2
8
0 831
8
2
8
0 780
8
2
8
0 449
8
2
8
0 633
8
2
8
0 622
8
2
8
0 767
8
2
8
1 767
8
0 903
8
2
8
0 213
8
2
8
0 92
8
2
8
0 762
8
2
8
0 733
8
2
8
0 389
8
2
8
0 377
8
2
8
0 934
8
2
8
0 134
8
2
8
1 134
8
0 36
8
2
...

result:

ok 

Test #40:

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

input:

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

output:

8
0 448
8
2
8
0 119
8
2
8
0 955
8
2
8
0 466
8
2
8
0 212
8
2
8
0 993
8
2
8
0 655
8
2
8
0 381
8
2
8
0 500
8
2
8
0 298
8
2
8
0 738
8
2
8
0 115
8
2
8
0 397
8
2
8
0 779
8
2
8
0 863
8
2
8
0 517
8
2
8
0 549
8
2
8
0 962
8
2
8
0 679
8
2
8
1 679
8
0 684
8
2
8
0 108
8
2
8
0 306
8
2
8
0 155
8
2
8
1 155
8
0 985
...

result:

ok 

Test #41:

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

input:

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

output:

8
0 805
8
2
8
0 74
8
2
8
0 447
8
2
8
0 548
8
2
8
0 798
8
2
8
0 307
8
2
8
0 66
8
2
8
0 958
8
2
8
0 168
8
2
8
0 292
8
2
8
0 562
8
2
8
0 538
8
2
8
0 45
8
2
8
0 637
8
2
8
0 13
8
2
8
0 778
8
2
8
0 178
8
2
8
0 525
8
2
8
0 220
8
2
8
0 759
8
2
8
0 729
8
2
8
0 653
8
2
8
1 653
8
0 405
8
2
8
0 567
8
2
8
0 236
...

result:

ok 

Test #42:

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

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

output:

8
0 805
8
2
8
0 74
8
2
8
0 447
8
2
8
0 548
8
2
8
0 798
8
2
8
0 307
8
2
8
0 66
8
2
8
0 958
8
2
8
0 168
8
2
8
0 292
8
2
8
0 562
8
2
8
0 538
8
2
8
0 45
8
2
8
0 637
8
2
8
0 13
8
2
8
0 778
8
2
8
0 178
8
2
8
0 525
8
2
8
0 220
8
2
8
0 759
8
2
8
0 729
8
2
8
0 653
8
2
8
0 405
8
2
8
0 567
8
2
8
0 236
8
2
8
0 ...

result:

ok 

Subtask #3:

score: 29.77
Acceptable Answer

Test #43:

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

input:

2
1
2

output:

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

result:

ok 

Test #44:

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

input:

2
1
1

output:

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

result:

ok 

Test #45:

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

input:

3
1
1
2

output:

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

result:

ok 

Test #46:

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

input:

6
1
2
2
2
2
1
2
3
3
3

output:

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

input:

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

output:

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

result:

ok 

Test #48:

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

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 701
8
2
8
0 1555
8
2
8
1 1555
8
0 1200
8
2
8
1 1200
8
0 1954
8
2
8
1 1954
8
0 1106
8
2
8
1 1106
8
0 1317
8
2
8
1 1317
8
0 734
8
2
8
1 734
8
0 1929
8
2
8
1 1929
8
0 1243
8
2
8
1 1243
8
0 1573
8
2
8
1 1573
8
0 1793
8
2
8
1 1793
8
0 1784
8
2
8
1 1784
8
0 1941
8
2
8
1 1941
8
0 1079
8
2
8
1 1079
8
0 ...

result:

ok 

Test #49:

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

input:

2000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

8
0 701
8
2
8
0 1555
8
2
8
0 1200
8
2
8
0 1954
8
2
8
0 1106
8
2
8
0 1317
8
2
8
0 734
8
2
8
0 1929
8
2
8
0 1243
8
2
8
0 1573
8
2
8
0 1793
8
2
8
0 1784
8
2
8
0 1941
8
2
8
0 1079
8
2
8
0 1808
8
2
8
0 564
8
2
8
0 905
8
2
8
0 1925
8
2
8
0 1107
8
2
8
0 995
8
2
8
0 1689
8
2
8
0 1320
8
2
8
0 272
8
2
8
0 163...

result:

ok 

Test #50:

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

input:

2000
1
1
1
1
2
1
1
1
1
2
1
1
1
2
1
1
1
1
1
1
1
2
1
2
1
2
1
2
1
1
2
2
2
2
2
2
2
1
1
1
2
1
2
1
2
2
1
2
1
2
2
2
1
1
2
2
2
1
2
2
2
2
1
2
2
2
2
1
2
2
1
2
2
2
2
1
2
1
2
2
2
2
2
1
2
2
2
2
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
2
2
2
2
2
2
2
2
2
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 701
8
2
8
0 1555
8
2
8
0 1200
8
2
8
0 1954
8
2
8
0 1106
8
2
8
1 1106
8
0 1317
8
2
8
0 734
8
2
8
0 1929
8
2
8
0 1243
8
2
8
0 1573
8
2
8
1 1573
8
0 1793
8
2
8
0 1784
8
2
8
0 1941
8
2
8
0 1079
8
2
8
1 1079
8
0 1808
8
2
8
0 564
8
2
8
0 905
8
2
8
0 1925
8
2
8
0 1107
8
2
8
0 995
8
2
8
0 1689
8
2
8
0 1...

result:

ok 

Test #51:

score: 62.04
Acceptable Answer
time: 46ms
memory: 3796kb

input:

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

output:

8
0 701
8
2
8
0 1555
8
2
8
0 1200
8
2
8
0 1954
8
2
8
0 1106
8
2
8
0 1317
8
2
8
0 734
8
2
8
0 1929
8
2
8
1 1929
8
0 1243
8
2
8
0 1573
8
2
8
1 1573
8
0 1793
8
2
8
0 1784
8
2
8
0 1941
8
2
8
1 1941
8
0 1079
8
2
8
0 1808
8
2
8
0 564
8
2
8
0 905
8
2
8
1 905
8
0 1925
8
2
8
0 1107
8
2
8
1 1107
8
0 995
8
2
8...

result:

points 0.82720 points  0.82720

Test #52:

score: 29.99
Acceptable Answer
time: 29ms
memory: 3844kb

input:

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

output:

8
0 701
8
2
8
0 1555
8
2
8
1 1555
8
0 1200
8
2
8
1 1200
8
0 1954
8
2
8
1 1954
8
0 1106
8
2
8
1 1106
8
0 1317
8
2
8
1 1317
8
0 734
8
2
8
1 734
8
0 1929
8
2
8
1 1929
8
0 1243
8
2
8
1 1243
8
0 1573
8
2
8
1 1573
8
0 1793
8
2
8
1 1793
8
0 1784
8
2
8
1 1784
8
0 1941
8
2
8
1 1941
8
0 1079
8
2
8
1 1079
8
0 ...

result:

points 0.39986666670 points  0.39986666670

Test #53:

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

input:

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

output:

8
0 701
8
2
8
0 1555
8
2
8
1 1555
8
0 1200
8
2
8
0 1954
8
2
8
0 1106
8
2
8
0 1317
8
2
8
0 734
8
2
8
1 734
8
0 1929
8
2
8
0 1243
8
2
8
1 1243
8
0 1573
8
2
8
0 1793
8
2
8
0 1784
8
2
8
1 1784
8
0 1941
8
2
8
0 1079
8
2
8
1 1079
8
0 1808
8
2
8
1 1808
8
0 564
8
2
8
0 905
8
2
8
0 1925
8
2
8
1 1925
8
0 1107...

result:

ok 

Test #54:

score: 29.77
Acceptable Answer
time: 10ms
memory: 3728kb

input:

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

output:

8
0 701
8
2
8
0 1555
8
2
8
0 1200
8
2
8
1 1200
8
0 1954
8
2
8
0 1106
8
2
8
1 1106
8
0 1317
8
2
8
1 1317
8
0 734
8
2
8
0 1929
8
2
8
1 1929
8
0 1243
8
2
8
1 1243
8
0 1573
8
2
8
1 1573
8
0 1793
8
2
8
1 1793
8
0 1784
8
2
8
1 1784
8
0 1941
8
2
8
1 1941
8
0 1079
8
2
8
1 1079
8
0 1808
8
2
8
1 1808
8
0 564
...

result:

points 0.39693333330 points  0.39693333330

Test #55:

score: 57.99
Acceptable Answer
time: 23ms
memory: 3800kb

input:

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

output:

8
0 701
8
2
8
0 1555
8
2
8
0 1200
8
2
8
0 1954
8
2
8
0 1106
8
2
8
0 1317
8
2
8
0 734
8
2
8
0 1929
8
2
8
0 1243
8
2
8
0 1573
8
2
8
1 1573
8
0 1793
8
2
8
0 1784
8
2
8
0 1941
8
2
8
0 1079
8
2
8
0 1808
8
2
8
0 564
8
2
8
0 905
8
2
8
0 1925
8
2
8
0 1107
8
2
8
0 995
8
2
8
0 1689
8
2
8
0 1320
8
2
8
0 272
8
...

result:

points 0.77320 points  0.77320

Test #56:

score: 69.11
Acceptable Answer
time: 16ms
memory: 3844kb

input:

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

output:

8
0 999
8
2
8
0 1887
8
2
8
0 1031
8
2
8
1 1031
8
0 37
8
2
8
0 941
8
2
8
0 1937
8
2
8
0 1032
8
2
8
1 1032
8
0 1222
8
2
8
1 1222
8
0 1275
8
2
8
1 1275
8
0 523
8
2
8
1 523
8
0 1483
8
2
8
1 1483
8
0 811
8
2
8
1 811
8
0 200
8
2
8
1 200
8
0 1197
8
2
8
1 1197
8
0 1574
8
2
8
1 1574
8
0 1440
8
2
8
1 1440
8
0...

result:

points 0.92146666670 points  0.92146666670

Test #57:

score: 69.17
Acceptable Answer
time: 10ms
memory: 3728kb

input:

1999
1
1
1
1
2
1
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1507
8
2
8
0 368
8
2
8
0 1339
8
2
8
0 1289
8
2
8
0 19
8
2
8
1 19
8
0 1104
8
2
8
0 676
8
2
8
0 1576
8
2
8
1 1576
8
0 82
8
2
8
1 82
8
0 1397
8
2
8
1 1397
8
0 1388
8
2
8
1 1388
8
0 1248
8
2
8
1 1248
8
0 1132
8
2
8
0 97
8
2
8
1 97
8
0 883
8
2
8
1 883
8
0 275
8
2
8
1 275
8
0 1710
8
2
8
1 1710
8
0 177...

result:

points 0.92226666670 points  0.92226666670

Test #58:

score: 68.13
Acceptable Answer
time: 31ms
memory: 3688kb

input:

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

output:

8
0 672
8
2
8
0 433
8
2
8
0 1391
8
2
8
1 1391
8
0 1724
8
2
8
0 725
8
2
8
0 1981
8
2
8
1 1981
8
0 786
8
2
8
1 786
8
0 1747
8
2
8
1 1747
8
0 475
8
2
8
1 475
8
0 694
8
2
8
0 652
8
2
8
0 1292
8
2
8
1 1292
8
0 1428
8
2
8
0 680
8
2
8
1 680
8
0 736
8
2
8
1 736
8
0 701
8
2
8
0 1920
8
2
8
1 1920
8
0 932
8
2
...

result:

points 0.90840 points  0.90840

Test #59:

score: 67.55
Acceptable Answer
time: 26ms
memory: 3748kb

input:

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

output:

8
0 999
8
2
8
0 1887
8
2
8
0 1031
8
2
8
1 1031
8
0 37
8
2
8
0 941
8
2
8
0 1937
8
2
8
0 1032
8
2
8
1 1032
8
0 1222
8
2
8
0 1275
8
2
8
0 523
8
2
8
0 1483
8
2
8
1 1483
8
0 811
8
2
8
1 811
8
0 200
8
2
8
0 1197
8
2
8
1 1197
8
0 1574
8
2
8
1 1574
8
0 1440
8
2
8
1 1440
8
0 1021
8
2
8
1 1021
8
0 1552
8
2
8
...

result:

points 0.90066666670 points  0.90066666670

Test #60:

score: 72.6
Acceptable Answer
time: 19ms
memory: 3792kb

input:

1996
1
1
2
1
1
1
1
1
2
2
2
1
2
2
1
2
2
1
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 239
8
2
8
0 1087
8
2
8
0 1936
8
2
8
1 1936
8
0 1279
8
2
8
0 400
8
2
8
0 153
8
2
8
0 1828
8
2
8
0 942
8
2
8
0 1825
8
2
8
1 1825
8
0 1721
8
2
8
1 1721
8
0 1914
8
2
8
1 1914
8
0 853
8
2
8
0 447
8
2
8
1 447
8
0 259
8
2
8
1 259
8
0 616
8
2
8
0 302
8
2
8
1 302
8
0 894
8
2
8
1 894
8
0 1636
8
2
8
0 1476...

result:

points 0.9680 points  0.9680

Test #61:

score: 67.2
Acceptable Answer
time: 16ms
memory: 3788kb

input:

2000
1
1
1
1
1
1
2
1
1
2
2
2
1
1
2
1
2
1
2
1
2
1
2
2
1
2
2
2
2
2
2
2
2
1
2
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 701
8
2
8
0 1555
8
2
8
0 1200
8
2
8
0 1954
8
2
8
0 1106
8
2
8
0 1317
8
2
8
0 734
8
2
8
1 734
8
0 1929
8
2
8
0 1243
8
2
8
0 1573
8
2
8
1 1573
8
0 1793
8
2
8
1 1793
8
0 1784
8
2
8
1 1784
8
0 1941
8
2
8
0 1079
8
2
8
0 1808
8
2
8
1 1808
8
0 564
8
2
8
0 905
8
2
8
1 905
8
0 1925
8
2
8
0 1107
8
2
8
1 1...

result:

points 0.8960 points  0.8960

Test #62:

score: 65.62
Acceptable Answer
time: 10ms
memory: 3732kb

input:

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

output:

8
0 999
8
2
8
0 1887
8
2
8
0 1031
8
2
8
0 37
8
2
8
0 941
8
2
8
0 1937
8
2
8
0 1032
8
2
8
0 1222
8
2
8
0 1275
8
2
8
0 523
8
2
8
0 1483
8
2
8
1 1483
8
0 811
8
2
8
0 200
8
2
8
0 1197
8
2
8
0 1574
8
2
8
1 1574
8
0 1440
8
2
8
0 1021
8
2
8
0 1552
8
2
8
1 1552
8
0 1554
8
2
8
1 1554
8
0 1154
8
2
8
0 1809
8
...

result:

points 0.87493333330 points  0.87493333330

Test #63:

score: 72.34
Acceptable Answer
time: 13ms
memory: 3728kb

input:

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

output:

8
0 701
8
2
8
0 1555
8
2
8
0 1200
8
2
8
0 1954
8
2
8
0 1106
8
2
8
0 1317
8
2
8
0 734
8
2
8
0 1929
8
2
8
0 1243
8
2
8
0 1573
8
2
8
0 1793
8
2
8
1 1793
8
0 1784
8
2
8
0 1941
8
2
8
0 1079
8
2
8
0 1808
8
2
8
0 564
8
2
8
0 905
8
2
8
0 1925
8
2
8
0 1107
8
2
8
0 995
8
2
8
0 1689
8
2
8
0 1320
8
2
8
0 272
8
...

result:

points 0.96453333330 points  0.96453333330

Test #64:

score: 71.89
Acceptable Answer
time: 21ms
memory: 3736kb

input:

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

output:

8
0 1194
8
2
8
0 102
8
2
8
0 1193
8
2
8
0 1833
8
2
8
0 1181
8
2
8
0 1174
8
2
8
0 685
8
2
8
0 705
8
2
8
0 133
8
2
8
0 973
8
2
8
0 1062
8
2
8
0 215
8
2
8
0 803
8
2
8
0 423
8
2
8
0 187
8
2
8
0 1386
8
2
8
0 1811
8
2
8
0 404
8
2
8
0 1739
8
2
8
0 1941
8
2
8
1 1941
8
0 645
8
2
8
0 548
8
2
8
0 445
8
2
8
0 4...

result:

points 0.95853333330 points  0.95853333330

Test #65:

score: 75
Accepted
time: 22ms
memory: 3736kb

input:

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

output:

8
0 1507
8
2
8
0 368
8
2
8
0 1339
8
2
8
0 1289
8
2
8
0 19
8
2
8
0 1104
8
2
8
0 676
8
2
8
0 1576
8
2
8
0 82
8
2
8
0 1397
8
2
8
0 1388
8
2
8
0 1248
8
2
8
0 1132
8
2
8
0 97
8
2
8
0 883
8
2
8
0 275
8
2
8
0 1710
8
2
8
0 1775
8
2
8
0 1737
8
2
8
0 1236
8
2
8
0 1982
8
2
8
0 711
8
2
8
0 1208
8
2
8
0 1712
8
2...

result:

ok 

Test #66:

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

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

output:

8
0 999
8
2
8
0 1887
8
2
8
0 1031
8
2
8
0 37
8
2
8
0 941
8
2
8
0 1937
8
2
8
0 1032
8
2
8
0 1222
8
2
8
0 1275
8
2
8
0 523
8
2
8
0 1483
8
2
8
0 811
8
2
8
0 200
8
2
8
0 1197
8
2
8
0 1574
8
2
8
0 1440
8
2
8
0 1021
8
2
8
0 1552
8
2
8
0 1554
8
2
8
0 1154
8
2
8
0 1809
8
2
8
0 693
8
2
8
0 1562
8
2
8
0 572
8...

result:

ok 

Test #67:

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

input:

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

output:

8
0 1507
8
2
8
0 368
8
2
8
0 1339
8
2
8
0 1289
8
2
8
0 19
8
2
8
0 1104
8
2
8
0 676
8
2
8
0 1576
8
2
8
0 82
8
2
8
0 1397
8
2
8
0 1388
8
2
8
0 1248
8
2
8
0 1132
8
2
8
0 97
8
2
8
0 883
8
2
8
0 275
8
2
8
0 1710
8
2
8
0 1775
8
2
8
0 1737
8
2
8
0 1236
8
2
8
0 1982
8
2
8
0 711
8
2
8
0 1208
8
2
8
0 1712
8
2...

result:

ok 

Test #68:

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

input:

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

output:

8
0 658
8
2
8
0 1483
8
2
8
0 638
8
2
8
0 755
8
2
8
0 824
8
2
8
0 1557
8
2
8
0 796
8
2
8
0 442
8
2
8
1 442
8
0 1870
8
2
8
0 733
8
2
8
0 864
8
2
8
0 107
8
2
8
1 107
8
0 1655
8
2
8
0 1920
8
2
8
0 1314
8
2
8
0 1705
8
2
8
0 976
8
2
8
1 976
8
0 328
8
2
8
0 759
8
2
8
0 1631
8
2
8
1 1631
8
0 1502
8
2
8
0 29...

result:

ok 

Test #69:

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

input:

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

output:

8
0 658
8
2
8
0 1483
8
2
8
0 638
8
2
8
0 755
8
2
8
0 824
8
2
8
0 1557
8
2
8
0 796
8
2
8
0 442
8
2
8
1 442
8
0 1870
8
2
8
0 733
8
2
8
0 864
8
2
8
0 107
8
2
8
1 107
8
0 1655
8
2
8
0 1920
8
2
8
0 1314
8
2
8
0 1705
8
2
8
0 976
8
2
8
1 976
8
0 328
8
2
8
0 759
8
2
8
0 1631
8
2
8
1 1631
8
0 1502
8
2
8
0 29...

result:

ok 

Test #70:

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

input:

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

output:

8
0 658
8
2
8
0 1483
8
2
8
0 638
8
2
8
0 755
8
2
8
0 824
8
2
8
0 1557
8
2
8
1 1557
8
0 796
8
2
8
0 442
8
2
8
0 1870
8
2
8
0 733
8
2
8
0 864
8
2
8
0 107
8
2
8
1 107
8
0 1655
8
2
8
0 1920
8
2
8
0 1314
8
2
8
0 1705
8
2
8
1 1705
8
0 976
8
2
8
0 328
8
2
8
1 328
8
0 759
8
2
8
0 1631
8
2
8
1 1631
8
0 1502
...

result:

ok 

Test #71:

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

input:

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

output:

8
0 658
8
2
8
0 1483
8
2
8
0 638
8
2
8
0 755
8
2
8
0 824
8
2
8
0 1557
8
2
8
1 1557
8
0 796
8
2
8
0 442
8
2
8
0 1870
8
2
8
0 733
8
2
8
0 864
8
2
8
0 107
8
2
8
1 107
8
0 1655
8
2
8
0 1920
8
2
8
0 1314
8
2
8
0 1705
8
2
8
1 1705
8
0 976
8
2
8
0 328
8
2
8
1 328
8
0 759
8
2
8
0 1631
8
2
8
1 1631
8
0 1502
...

result:

ok 

Test #72:

score: 62.01
Acceptable Answer
time: 21ms
memory: 3732kb

input:

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

output:

8
0 326
8
2
8
0 321
8
2
8
0 1137
8
2
8
0 1573
8
2
8
0 1839
8
2
8
0 1971
8
2
8
0 1304
8
2
8
0 1116
8
2
8
0 1132
8
2
8
0 196
8
2
8
0 1504
8
2
8
0 1926
8
2
8
0 1028
8
2
8
0 1570
8
2
8
0 818
8
2
8
0 327
8
2
8
0 95
8
2
8
1 95
8
0 1817
8
2
8
0 782
8
2
8
0 919
8
2
8
0 1299
8
2
8
0 1289
8
2
8
0 1005
8
2
8
0...

result:

points 0.82680 points  0.82680

Test #73:

score: 62.8
Acceptable Answer
time: 18ms
memory: 3724kb

input:

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

output:

8
0 326
8
2
8
0 321
8
2
8
0 1137
8
2
8
0 1573
8
2
8
0 1839
8
2
8
1 1839
8
0 1971
8
2
8
0 1304
8
2
8
0 1116
8
2
8
0 1132
8
2
8
0 196
8
2
8
0 1504
8
2
8
0 1926
8
2
8
0 1028
8
2
8
0 1570
8
2
8
1 1570
8
0 818
8
2
8
0 327
8
2
8
0 95
8
2
8
0 1817
8
2
8
0 782
8
2
8
0 919
8
2
8
1 919
8
0 1299
8
2
8
0 1289
8...

result:

points 0.83733333330 points  0.83733333330

Test #74:

score: 68.78
Acceptable Answer
time: 23ms
memory: 3708kb

input:

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

output:

8
0 534
8
2
8
0 1759
8
2
8
0 1271
8
2
8
0 1900
8
2
8
0 1813
8
2
8
0 925
8
2
8
0 1914
8
2
8
0 120
8
2
8
0 1569
8
2
8
0 132
8
2
8
0 1652
8
2
8
0 1114
8
2
8
1 1114
8
0 83
8
2
8
0 1028
8
2
8
0 1532
8
2
8
0 1344
8
2
8
0 367
8
2
8
1 367
8
0 385
8
2
8
0 1584
8
2
8
0 1350
8
2
8
0 106
8
2
8
0 659
8
2
8
0 159...

result:

points 0.91706666670 points  0.91706666670

Test #75:

score: 66.23
Acceptable Answer
time: 11ms
memory: 3736kb

input:

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

output:

8
0 534
8
2
8
0 1759
8
2
8
0 1271
8
2
8
0 1900
8
2
8
0 1813
8
2
8
0 925
8
2
8
0 1914
8
2
8
0 120
8
2
8
0 1569
8
2
8
0 132
8
2
8
0 1652
8
2
8
0 1114
8
2
8
1 1114
8
0 83
8
2
8
0 1028
8
2
8
0 1532
8
2
8
0 1344
8
2
8
0 367
8
2
8
1 367
8
0 385
8
2
8
0 1584
8
2
8
0 1350
8
2
8
0 106
8
2
8
0 659
8
2
8
0 159...

result:

points 0.88306666670 points  0.88306666670

Test #76:

score: 75
Accepted
time: 22ms
memory: 3732kb

input:

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

output:

8
0 1507
8
2
8
0 534
8
2
8
0 1572
8
2
8
0 443
8
2
8
0 622
8
2
8
0 511
8
2
8
0 230
8
2
8
0 342
8
2
8
0 447
8
2
8
0 1446
8
2
8
1 1446
8
0 1532
8
2
8
0 1140
8
2
8
1 1140
8
0 1740
8
2
8
0 168
8
2
8
0 1109
8
2
8
0 512
8
2
8
0 643
8
2
8
0 766
8
2
8
1 766
8
0 672
8
2
8
0 617
8
2
8
0 655
8
2
8
0 650
8
2
8
0...

result:

ok 

Test #77:

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

input:

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

output:

8
0 1507
8
2
8
0 534
8
2
8
0 1572
8
2
8
0 443
8
2
8
0 622
8
2
8
0 511
8
2
8
0 230
8
2
8
0 342
8
2
8
0 447
8
2
8
1 447
8
0 1446
8
2
8
0 1532
8
2
8
1 1532
8
0 1140
8
2
8
0 1740
8
2
8
0 168
8
2
8
0 1109
8
2
8
0 512
8
2
8
0 643
8
2
8
1 643
8
0 766
8
2
8
0 672
8
2
8
1 672
8
0 617
8
2
8
0 655
8
2
8
1 655
...

result:

ok 

Test #78:

score: 62.79
Acceptable Answer
time: 57ms
memory: 3728kb

input:

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

output:

8
0 567
8
2
8
0 1521
8
2
8
0 1234
8
2
8
0 1743
8
2
8
0 1486
8
2
8
0 210
8
2
8
0 1734
8
2
8
0 75
8
2
8
0 396
8
2
8
0 569
8
2
8
0 454
8
2
8
0 788
8
2
8
0 1739
8
2
8
0 1398
8
2
8
1 1398
8
0 1422
8
2
8
0 432
8
2
8
0 1175
8
2
8
1 1175
8
0 1750
8
2
8
0 855
8
2
8
0 297
8
2
8
0 500
8
2
8
1 500
8
0 1198
8
2
...

result:

points 0.83720 points  0.83720

Test #79:

score: 64.27
Acceptable Answer
time: 33ms
memory: 3784kb

input:

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

output:

8
0 567
8
2
8
0 1521
8
2
8
0 1234
8
2
8
0 1743
8
2
8
0 1486
8
2
8
0 210
8
2
8
0 1734
8
2
8
0 75
8
2
8
0 396
8
2
8
0 569
8
2
8
0 454
8
2
8
0 788
8
2
8
0 1739
8
2
8
0 1398
8
2
8
1 1398
8
0 1422
8
2
8
0 432
8
2
8
0 1175
8
2
8
1 1175
8
0 1750
8
2
8
0 855
8
2
8
0 297
8
2
8
0 500
8
2
8
1 500
8
0 1198
8
2
...

result:

points 0.85693333330 points  0.85693333330

Test #80:

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

input:

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

output:

8
0 701
8
2
8
0 1555
8
2
8
0 1200
8
2
8
0 1954
8
2
8
0 1106
8
2
8
0 1317
8
2
8
1 1317
8
0 734
8
2
8
0 1929
8
2
8
0 1243
8
2
8
0 1573
8
2
8
0 1793
8
2
8
0 1784
8
2
8
0 1941
8
2
8
0 1079
8
2
8
0 1808
8
2
8
1 1808
8
0 564
8
2
8
0 905
8
2
8
0 1925
8
2
8
1 1925
8
0 1107
8
2
8
0 995
8
2
8
0 1689
8
2
8
0 1...

result:

ok 

Test #81:

score: 75
Accepted
time: 13ms
memory: 3736kb

input:

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

output:

8
0 701
8
2
8
0 1555
8
2
8
0 1200
8
2
8
0 1954
8
2
8
0 1106
8
2
8
0 1317
8
2
8
1 1317
8
0 734
8
2
8
0 1929
8
2
8
0 1243
8
2
8
0 1573
8
2
8
0 1793
8
2
8
0 1784
8
2
8
0 1941
8
2
8
0 1079
8
2
8
0 1808
8
2
8
1 1808
8
0 564
8
2
8
0 905
8
2
8
0 1925
8
2
8
1 1925
8
0 1107
8
2
8
0 995
8
2
8
0 1689
8
2
8
0 1...

result:

ok 

Test #82:

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

input:

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

output:

8
0 701
8
2
8
0 1555
8
2
8
0 1200
8
2
8
0 1954
8
2
8
0 1106
8
2
8
0 1317
8
2
8
0 734
8
2
8
1 734
8
0 1929
8
2
8
0 1243
8
2
8
0 1573
8
2
8
0 1793
8
2
8
1 1793
8
0 1784
8
2
8
0 1941
8
2
8
0 1079
8
2
8
0 1808
8
2
8
0 564
8
2
8
0 905
8
2
8
1 905
8
0 1925
8
2
8
0 1107
8
2
8
0 995
8
2
8
0 1689
8
2
8
0 132...

result:

ok 

Test #83:

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

input:

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

output:

8
0 701
8
2
8
0 1555
8
2
8
0 1200
8
2
8
0 1954
8
2
8
1 1954
8
0 1106
8
2
8
0 1317
8
2
8
0 734
8
2
8
0 1929
8
2
8
0 1243
8
2
8
0 1573
8
2
8
0 1793
8
2
8
0 1784
8
2
8
0 1941
8
2
8
0 1079
8
2
8
0 1808
8
2
8
0 564
8
2
8
0 905
8
2
8
1 905
8
0 1925
8
2
8
0 1107
8
2
8
1 1107
8
0 995
8
2
8
0 1689
8
2
8
1 16...

result:

ok 

Test #84:

score: 50.04
Acceptable Answer
time: 6ms
memory: 3712kb

input:

540
1
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 32
8
2
8
0 236
8
2
8
1 236
8
0 500
8
2
8
0 324
8
2
8
1 324
8
0 468
8
2
8
1 468
8
0 35
8
2
8
1 35
8
0 376
8
2
8
0 363
8
2
8
1 363
8
0 404
8
2
8
1 404
8
0 274
8
2
8
1 274
8
0 529
8
2
8
1 529
8
0 291
8
2
8
1 291
8
0 360
8
2
8
1 360
8
0 353
8
2
8
1 353
8
0 470
8
2
8
1 470
8
0 16
8
2
8
1 16
8
0 390
8...

result:

points 0.66720 points  0.66720

Test #85:

score: 35.21
Acceptable Answer
time: 34ms
memory: 3792kb

input:

1834
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
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 618
8
2
8
0 1071
8
2
8
0 274
8
2
8
0 645
8
2
8
1 645
8
0 625
8
2
8
1 625
8
0 1169
8
2
8
1 1169
8
0 1234
8
2
8
1 1234
8
0 300
8
2
8
1 300
8
0 230
8
2
8
1 230
8
0 175
8
2
8
1 175
8
0 1442
8
2
8
1 1442
8
0 387
8
2
8
1 387
8
0 1785
8
2
8
1 1785
8
0 558
8
2
8
1 558
8
0 529
8
2
8
1 529
8
0 463
8
2
8
1...

result:

points 0.46946666670 points  0.46946666670

Test #86:

score: 75
Accepted
time: 13ms
memory: 3728kb

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 701
8
2
8
0 1555
8
2
8
1 1555
8
0 1200
8
2
8
1 1200
8
0 1954
8
2
8
0 1106
8
2
8
1 1106
8
0 1317
8
2
8
1 1317
8
0 734
8
2
8
1 734
8
0 1929
8
2
8
1 1929
8
0 1243
8
2
8
1 1243
8
0 1573
8
2
8
1 1573
8
0 1793
8
2
8
1 1793
8
0 1784
8
2
8
1 1784
8
0 1941
8
2
8
1 1941
8
0 1079
8
2
8
1 1079
8
0 1808
8
2
...

result:

ok 

Test #87:

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

input:

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

output:

8
0 701
8
2
8
0 1555
8
2
8
0 1200
8
2
8
0 1954
8
2
8
0 1106
8
2
8
0 1317
8
2
8
0 734
8
2
8
1 734
8
0 1929
8
2
8
0 1243
8
2
8
0 1573
8
2
8
0 1793
8
2
8
0 1784
8
2
8
0 1941
8
2
8
0 1079
8
2
8
0 1808
8
2
8
0 564
8
2
8
1 564
8
0 905
8
2
8
1 905
8
0 1925
8
2
8
0 1107
8
2
8
0 995
8
2
8
1 995
8
0 1689
8
2
...

result:

ok 

Test #88:

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

input:

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

output:

8
0 701
8
2
8
0 1555
8
2
8
0 1200
8
2
8
1 1200
8
0 1954
8
2
8
1 1954
8
0 1106
8
2
8
1 1106
8
0 1317
8
2
8
1 1317
8
0 734
8
2
8
0 1929
8
2
8
1 1929
8
0 1243
8
2
8
1 1243
8
0 1573
8
2
8
1 1573
8
0 1793
8
2
8
1 1793
8
0 1784
8
2
8
1 1784
8
0 1941
8
2
8
1 1941
8
0 1079
8
2
8
1 1079
8
0 1808
8
2
8
1 1808...

result:

ok 

Test #89:

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

input:

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

output:

8
0 701
8
2
8
0 1555
8
2
8
0 1200
8
2
8
0 1954
8
2
8
1 1954
8
0 1106
8
2
8
0 1317
8
2
8
0 734
8
2
8
0 1929
8
2
8
1 1929
8
0 1243
8
2
8
0 1573
8
2
8
1 1573
8
0 1793
8
2
8
1 1793
8
0 1784
8
2
8
1 1784
8
0 1941
8
2
8
1 1941
8
0 1079
8
2
8
0 1808
8
2
8
1 1808
8
0 564
8
2
8
0 905
8
2
8
0 1925
8
2
8
1 192...

result:

ok