QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#793041#4565. Rarest Insects_8_8_#10 92ms4288kbC++201.5kb2024-11-29 16:08:462024-11-29 16:08:50

Judging History

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

  • [2024-11-29 16:08:50]
  • 评测
  • 测评结果:10
  • 用时:92ms
  • 内存:4288kb
  • [2024-11-29 16:08:46]
  • 提交

answer

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

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n;
vector<int> p;
set<int> cur;

void add(int i) {
    cur.insert(i);
    i = p[i];
    move_inside(i);
}
void del(int i) {
    cur.erase(i);
    i = p[i];
    move_outside(i);
}
vector<vector<int>> solve(int l, int r) {
    if(l == r) {
        add(l);
        return {{l}};
    }
    int mid = (l + r) >> 1;
    auto L = solve(l, mid);
    while(!cur.empty()) {
        del(*cur.begin());
    }
    auto R = solve(mid + 1, r);
    vector<vector<int>> ret = R;
    for(auto v : L) {
        add(v[0]);
        if(press_button() == 1) {
            ret.push_back(v);
        } else {
            int it = 0;
            for(auto j : R) {
                del(j[0]);
                if(press_button() == 1) {
                    for(int f : v) {
                        ret[it].push_back(f);
                    }
                    add(j[0]);
                    break;
                }
                it++;
                add(j[0]);
            }
            del(v[0]);
        }
    }
    return ret;
}
int min_cardinality(int NN) {
    n = NN;
    int res = (int)1e9;
    p.resize(n);
    iota(p.begin(), p.end(), 0);
    shuffle(p.begin(), p.end(), rng);
    auto f = solve(0, n - 1);
    for(auto j : f) {
        res = min(res, (int)j.size());
    }
    return res;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

6
1
1
1
1
2
1
1
2
1
2
2
1
1

output:

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

result:

ok 

Test #2:

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

input:

2
2
1

output:

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

result:

ok 

Test #3:

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

input:

2
1

output:

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

result:

ok 

Test #4:

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

input:

3
1
1
2
1

output:

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

result:

ok 

Test #5:

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

input:

5
1
2
1
1
1
2
1
2
2
1

output:

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

result:

ok 

Test #6:

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

input:

8
1
1
1
2
2
1
2
1
1
2
1
2
2
1
2
1
1

output:

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

result:

ok 

Test #7:

score: 10
Accepted
time: 3ms
memory: 4116kb

input:

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

output:

8
0 29
8
1 29
8
0 178
8
0 29
8
2
8
1 178
8
2
8
0 178
8
1 29
8
1 178
8
0 85
8
1 85
8
0 26
8
0 85
8
2
8
1 26
8
2
8
0 26
8
1 85
8
0 178
8
2
8
1 26
8
2
8
0 26
8
1 178
8
1 26
8
0 174
8
1 174
8
0 5
8
0 174
8
2
8
1 5
8
2
8
0 5
8
1 174
8
1 5
8
0 125
8
0 5
8
2
8
1 125
8
2
8
0 125
8
1 5
8
0 26
8
2
8
1 125
8
2...

result:

ok 

Test #8:

score: 10
Accepted
time: 5ms
memory: 4148kb

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 176
8
1 176
8
0 62
8
0 176
8
2
8
1 176
8
1 62
8
0 138
8
1 138
8
0 132
8
0 138
8
2
8
0 62
8
2
8
0 176
8
2
8
1 176
8
1 62
8
1 138
8
1 132
8
0 47
8
1 47
8
0 157
8
0 47
8
2
8
1 47
8
1 157
8
0 131
8
0 157
8
2
8
0 47
8
2
8
0 132
8
2
8
0 138
8
2
8
0 62
8
2
8
0 176
8
2
8
1 176
8
1 62
8
1 138
8
1 132
8
1...

result:

ok 

Test #9:

score: 10
Accepted
time: 5ms
memory: 3876kb

input:

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

output:

8
0 53
8
1 53
8
0 81
8
0 53
8
2
8
1 53
8
1 81
8
0 169
8
1 169
8
0 134
8
0 169
8
2
8
1 134
8
2
8
0 134
8
1 169
8
0 81
8
2
8
0 53
8
2
8
1 53
8
1 81
8
1 134
8
0 86
8
1 86
8
0 147
8
0 86
8
2
8
1 86
8
1 147
8
0 126
8
0 147
8
2
8
0 86
8
2
8
0 134
8
2
8
0 81
8
2
8
0 53
8
2
8
1 53
8
1 81
8
1 134
8
1 86
8
1 ...

result:

ok 

Test #10:

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

input:

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

output:

8
0 74
8
1 74
8
0 86
8
0 74
8
2
8
1 74
8
1 86
8
0 87
8
1 87
8
0 73
8
0 87
8
2
8
0 86
8
2
8
0 74
8
2
8
1 74
8
1 86
8
1 87
8
1 73
8
0 173
8
1 173
8
0 145
8
0 173
8
2
8
1 173
8
1 145
8
0 71
8
0 145
8
2
8
0 173
8
2
8
0 73
8
2
8
0 87
8
2
8
0 86
8
2
8
1 71
8
2
8
0 71
8
1 145
8
2
8
0 145
8
1 86
8
0 74
8
2
...

result:

ok 

Test #11:

score: 10
Accepted
time: 3ms
memory: 3876kb

input:

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

output:

8
0 98
8
1 98
8
0 117
8
0 98
8
2
8
1 117
8
2
8
0 117
8
1 98
8
1 117
8
0 30
8
1 30
8
0 35
8
0 30
8
2
8
1 35
8
2
8
0 35
8
1 30
8
0 117
8
2
8
1 35
8
2
8
0 35
8
1 117
8
1 35
8
0 101
8
1 101
8
0 118
8
0 101
8
2
8
1 118
8
2
8
0 118
8
1 101
8
1 118
8
0 51
8
0 118
8
2
8
1 51
8
2
8
0 51
8
1 118
8
0 35
8
2
8
...

result:

ok 

Test #12:

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

input:

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

output:

8
0 15
8
1 15
8
0 181
8
0 15
8
2
8
1 181
8
2
8
0 181
8
1 15
8
1 181
8
0 60
8
1 60
8
0 146
8
0 60
8
2
8
0 181
8
2
8
1 146
8
2
8
0 146
8
1 60
8
2
8
0 60
8
1 181
8
1 60
8
1 146
8
0 160
8
1 160
8
0 140
8
0 160
8
2
8
1 160
8
1 140
8
0 119
8
0 140
8
2
8
0 160
8
2
8
0 146
8
2
8
0 60
8
2
8
1 119
8
2
8
0 119...

result:

ok 

Test #13:

score: 10
Accepted
time: 5ms
memory: 3812kb

input:

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

output:

8
0 100
8
1 100
8
0 184
8
0 100
8
2
8
1 100
8
1 184
8
0 85
8
1 85
8
0 87
8
0 85
8
2
8
0 184
8
2
8
1 87
8
2
8
0 87
8
1 184
8
0 100
8
2
8
1 100
8
1 85
8
1 87
8
0 192
8
1 192
8
0 51
8
0 192
8
2
8
1 192
8
1 51
8
0 26
8
0 51
8
2
8
0 192
8
2
8
1 26
8
2
8
0 26
8
1 192
8
0 87
8
2
8
0 85
8
2
8
0 100
8
2
8
1 ...

result:

ok 

Test #14:

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

input:

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

output:

8
0 35
8
1 35
8
0 150
8
0 35
8
2
8
1 35
8
1 150
8
0 122
8
1 122
8
0 52
8
0 122
8
2
8
0 150
8
2
8
1 52
8
2
8
0 52
8
1 150
8
0 35
8
2
8
1 35
8
1 122
8
1 52
8
0 53
8
1 53
8
0 120
8
0 53
8
2
8
1 53
8
1 120
8
0 123
8
0 120
8
2
8
0 53
8
2
8
0 52
8
2
8
0 122
8
2
8
0 35
8
2
8
1 123
8
2
8
0 123
8
1 35
8
1 12...

result:

ok 

Test #15:

score: 10
Accepted
time: 2ms
memory: 4100kb

input:

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

output:

8
0 117
8
1 117
8
0 134
8
0 117
8
2
8
1 117
8
1 134
8
0 43
8
1 43
8
0 198
8
0 43
8
2
8
0 134
8
2
8
1 198
8
2
8
0 198
8
1 43
8
2
8
0 43
8
1 134
8
0 117
8
2
8
1 117
8
1 43
8
1 198
8
0 169
8
1 169
8
0 66
8
0 169
8
2
8
1 66
8
2
8
0 66
8
1 169
8
1 66
8
0 133
8
0 66
8
2
8
0 198
8
2
8
0 43
8
2
8
0 117
8
2
...

result:

ok 

Test #16:

score: 10
Accepted
time: 3ms
memory: 3880kb

input:

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

output:

8
0 136
8
1 136
8
0 168
8
0 136
8
2
8
1 136
8
1 168
8
0 171
8
1 171
8
0 110
8
0 171
8
2
8
0 168
8
2
8
0 136
8
2
8
1 136
8
1 168
8
1 171
8
1 110
8
0 83
8
1 83
8
0 143
8
0 83
8
2
8
1 83
8
1 143
8
0 105
8
0 143
8
2
8
0 83
8
2
8
0 110
8
2
8
0 171
8
2
8
0 168
8
2
8
1 105
8
2
8
0 105
8
1 143
8
2
8
0 143
8...

result:

ok 

Test #17:

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

input:

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

output:

8
0 148
8
1 148
8
0 162
8
0 148
8
2
8
1 148
8
1 162
8
0 4
8
1 4
8
0 186
8
0 4
8
2
8
0 162
8
2
8
0 148
8
2
8
1 148
8
1 162
8
1 4
8
1 186
8
0 7
8
1 7
8
0 197
8
0 7
8
2
8
1 7
8
1 197
8
0 28
8
0 197
8
2
8
0 7
8
2
8
0 186
8
2
8
0 4
8
2
8
0 162
8
2
8
0 148
8
2
8
1 148
8
1 162
8
1 4
8
1 186
8
1 7
8
1 197
8...

result:

ok 

Test #18:

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

input:

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

output:

8
0 149
8
1 149
8
0 144
8
0 149
8
2
8
1 149
8
1 144
8
0 5
8
1 5
8
0 180
8
0 5
8
2
8
0 144
8
2
8
0 149
8
2
8
1 149
8
1 144
8
1 5
8
1 180
8
0 26
8
1 26
8
0 84
8
0 26
8
2
8
1 26
8
1 84
8
0 16
8
0 84
8
2
8
0 26
8
2
8
0 180
8
2
8
1 16
8
2
8
0 16
8
1 180
8
0 5
8
2
8
1 16
8
2
8
0 16
8
1 84
8
2
8
0 84
8
1 2...

result:

ok 

Test #19:

score: 10
Accepted
time: 3ms
memory: 3884kb

input:

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

output:

8
0 88
8
1 88
8
0 60
8
0 88
8
2
8
1 88
8
1 60
8
0 44
8
1 44
8
0 106
8
0 44
8
2
8
0 60
8
2
8
0 88
8
2
8
1 106
8
2
8
0 106
8
1 88
8
1 60
8
1 44
8
1 106
8
0 137
8
1 137
8
0 65
8
0 137
8
2
8
1 137
8
1 65
8
0 78
8
0 65
8
2
8
0 137
8
2
8
0 106
8
2
8
0 44
8
2
8
0 60
8
2
8
1 78
8
2
8
0 78
8
1 65
8
2
8
0 65
...

result:

ok 

Test #20:

score: 10
Accepted
time: 11ms
memory: 3960kb

input:

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

output:

8
0 32
8
1 32
8
0 24
8
0 32
8
2
8
1 32
8
1 24
8
0 154
8
1 154
8
0 128
8
0 154
8
2
8
0 24
8
2
8
0 32
8
2
8
1 32
8
1 24
8
1 154
8
1 128
8
0 163
8
1 163
8
0 34
8
0 163
8
2
8
1 163
8
1 34
8
0 95
8
0 34
8
2
8
0 163
8
2
8
0 128
8
2
8
0 154
8
2
8
0 24
8
2
8
0 32
8
2
8
1 32
8
1 24
8
1 154
8
1 128
8
1 163
8
...

result:

ok 

Test #21:

score: 10
Accepted
time: 9ms
memory: 3840kb

input:

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

output:

8
0 31
8
1 31
8
0 168
8
0 31
8
2
8
1 31
8
1 168
8
0 87
8
1 87
8
0 79
8
0 87
8
2
8
0 168
8
2
8
0 31
8
2
8
1 31
8
1 168
8
1 87
8
1 79
8
0 93
8
1 93
8
0 159
8
0 93
8
2
8
1 93
8
1 159
8
0 65
8
0 159
8
2
8
0 93
8
2
8
0 79
8
2
8
0 87
8
2
8
0 168
8
2
8
1 65
8
2
8
0 65
8
1 168
8
0 31
8
2
8
1 31
8
1 87
8
1 7...

result:

ok 

Test #22:

score: 10
Accepted
time: 8ms
memory: 4136kb

input:

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

output:

8
0 137
8
1 137
8
0 132
8
0 137
8
2
8
1 137
8
1 132
8
0 65
8
1 65
8
0 30
8
0 65
8
2
8
0 132
8
2
8
0 137
8
2
8
1 137
8
1 132
8
1 65
8
1 30
8
0 195
8
1 195
8
0 196
8
0 195
8
2
8
1 195
8
1 196
8
0 85
8
0 196
8
2
8
1 85
8
2
8
0 85
8
1 196
8
0 195
8
2
8
0 30
8
2
8
0 65
8
2
8
0 132
8
2
8
0 137
8
2
8
1 137...

result:

ok 

Test #23:

score: 10
Accepted
time: 16ms
memory: 3976kb

input:

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

output:

8
0 77
8
1 77
8
0 117
8
0 77
8
2
8
1 77
8
1 117
8
0 71
8
1 71
8
0 55
8
0 71
8
2
8
0 117
8
2
8
0 77
8
2
8
1 77
8
1 117
8
1 71
8
1 55
8
0 6
8
1 6
8
0 138
8
0 6
8
2
8
1 6
8
1 138
8
0 172
8
0 138
8
2
8
0 6
8
2
8
0 55
8
2
8
0 71
8
2
8
0 117
8
2
8
0 77
8
2
8
1 77
8
1 117
8
1 71
8
1 55
8
1 6
8
1 138
8
1 17...

result:

ok 

Subtask #2:

score: 0
Wrong Answer

Test #24:

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

input:

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

output:

8
0 330
8
1 330
8
0 347
8
0 330
8
2
8
1 347
8
2
8
0 347
8
1 330
8
1 347
8
0 754
8
1 754
8
0 593
8
0 754
8
2
8
1 593
8
2
8
0 593
8
1 754
8
0 347
8
2
8
1 593
8
2
8
0 593
8
1 347
8
1 593
8
0 257
8
1 257
8
0 678
8
0 257
8
2
8
1 678
8
2
8
0 678
8
1 257
8
1 678
8
0 399
8
1 399
8
0 516
8
0 399
8
2
8
1 516
...

result:

ok 

Test #25:

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

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 328
8
1 328
8
0 157
8
0 328
8
2
8
1 328
8
1 157
8
0 610
8
1 610
8
0 817
8
0 610
8
2
8
0 157
8
2
8
0 328
8
2
8
1 328
8
1 157
8
1 610
8
1 817
8
0 379
8
1 379
8
0 906
8
0 379
8
2
8
1 379
8
1 906
8
0 368
8
1 368
8
0 582
8
0 368
8
2
8
0 906
8
2
8
0 379
8
2
8
0 817
8
2
8
0 610
8
2
8
0 157
8
2
8
0 328
...

result:

ok 

Test #26:

score: 15
Accepted
time: 18ms
memory: 3916kb

input:

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

output:

8
0 815
8
1 815
8
0 784
8
0 815
8
2
8
1 815
8
1 784
8
0 322
8
1 322
8
0 692
8
0 322
8
2
8
0 784
8
2
8
0 815
8
2
8
1 815
8
1 784
8
1 322
8
1 692
8
0 161
8
1 161
8
0 672
8
0 161
8
2
8
1 161
8
1 672
8
0 872
8
1 872
8
0 226
8
0 872
8
2
8
0 672
8
2
8
0 161
8
2
8
0 692
8
2
8
0 322
8
2
8
0 784
8
2
8
0 815
...

result:

ok 

Test #27:

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

input:

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

output:

8
0 82
8
1 82
8
0 428
8
0 82
8
2
8
1 82
8
1 428
8
0 350
8
1 350
8
0 617
8
0 350
8
2
8
0 428
8
2
8
0 82
8
2
8
1 82
8
1 428
8
1 350
8
1 617
8
0 960
8
1 960
8
0 519
8
0 960
8
2
8
1 960
8
1 519
8
0 648
8
1 648
8
0 328
8
0 648
8
2
8
0 519
8
2
8
1 328
8
2
8
0 328
8
1 519
8
0 960
8
2
8
0 617
8
2
8
0 350
8
...

result:

ok 

Test #28:

score: 15
Accepted
time: 9ms
memory: 3840kb

input:

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

output:

8
0 380
8
1 380
8
0 299
8
0 380
8
2
8
1 299
8
2
8
0 299
8
1 380
8
1 299
8
0 769
8
1 769
8
0 486
8
0 769
8
2
8
1 486
8
2
8
0 486
8
1 769
8
0 299
8
2
8
1 486
8
2
8
0 486
8
1 299
8
1 486
8
0 63
8
1 63
8
0 65
8
0 63
8
2
8
1 65
8
2
8
0 65
8
1 63
8
1 65
8
0 667
8
1 667
8
0 533
8
0 667
8
2
8
1 533
8
2
8
0 ...

result:

ok 

Test #29:

score: 15
Accepted
time: 7ms
memory: 4024kb

input:

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

output:

8
0 271
8
1 271
8
0 984
8
0 271
8
2
8
1 984
8
2
8
0 984
8
1 271
8
1 984
8
0 174
8
1 174
8
0 753
8
0 174
8
2
8
0 984
8
2
8
1 984
8
1 174
8
1 753
8
0 861
8
1 861
8
0 673
8
0 861
8
2
8
1 861
8
1 673
8
0 962
8
1 962
8
0 118
8
0 962
8
2
8
0 673
8
2
8
1 118
8
2
8
0 118
8
1 673
8
0 861
8
2
8
0 753
8
2
8
0 ...

result:

ok 

Test #30:

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

input:

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

output:

8
0 216
8
1 216
8
0 533
8
0 216
8
2
8
1 216
8
1 533
8
0 663
8
1 663
8
0 702
8
0 663
8
2
8
0 533
8
2
8
0 216
8
2
8
1 216
8
1 533
8
1 663
8
1 702
8
0 641
8
1 641
8
0 377
8
0 641
8
2
8
1 641
8
1 377
8
0 707
8
1 707
8
0 62
8
0 707
8
2
8
0 377
8
2
8
0 641
8
2
8
1 62
8
2
8
0 62
8
1 707
8
2
8
0 707
8
1 641...

result:

ok 

Test #31:

score: 15
Accepted
time: 23ms
memory: 3864kb

input:

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

output:

8
0 122
8
1 122
8
0 190
8
0 122
8
2
8
1 122
8
1 190
8
0 852
8
1 852
8
0 219
8
0 852
8
2
8
0 190
8
2
8
0 122
8
2
8
1 122
8
1 190
8
1 852
8
1 219
8
0 8
8
1 8
8
0 898
8
0 8
8
2
8
1 8
8
1 898
8
0 188
8
1 188
8
0 541
8
0 188
8
2
8
0 898
8
2
8
0 8
8
2
8
0 219
8
2
8
0 852
8
2
8
1 541
8
2
8
0 541
8
1 188
8
...

result:

ok 

Test #32:

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

input:

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

output:

8
0 527
8
1 527
8
0 987
8
0 527
8
2
8
1 527
8
1 987
8
0 477
8
1 477
8
0 246
8
0 477
8
2
8
1 246
8
2
8
0 246
8
1 477
8
0 987
8
2
8
0 527
8
2
8
1 527
8
1 987
8
1 246
8
0 313
8
1 313
8
0 790
8
0 313
8
2
8
1 313
8
1 790
8
0 104
8
1 104
8
0 945
8
0 104
8
2
8
1 945
8
2
8
0 945
8
1 104
8
0 790
8
2
8
0 313
...

result:

ok 

Test #33:

score: 15
Accepted
time: 5ms
memory: 4076kb

input:

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

output:

8
0 640
8
1 640
8
0 868
8
0 640
8
2
8
1 640
8
1 868
8
0 113
8
1 113
8
0 502
8
0 113
8
2
8
1 502
8
2
8
0 502
8
1 113
8
0 868
8
2
8
0 640
8
2
8
1 640
8
1 868
8
1 502
8
0 812
8
1 812
8
0 216
8
0 812
8
2
8
1 812
8
1 216
8
0 417
8
1 417
8
0 457
8
0 417
8
2
8
1 457
8
2
8
0 457
8
1 417
8
0 216
8
2
8
0 812
...

result:

ok 

Test #34:

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

input:

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

output:

8
0 35
8
1 35
8
0 588
8
0 35
8
2
8
1 35
8
1 588
8
0 308
8
1 308
8
0 660
8
0 308
8
2
8
0 588
8
2
8
0 35
8
2
8
1 660
8
2
8
0 660
8
1 308
8
2
8
0 308
8
1 35
8
1 588
8
1 308
8
1 660
8
0 784
8
1 784
8
0 194
8
0 784
8
2
8
1 784
8
1 194
8
0 932
8
1 932
8
0 676
8
0 932
8
2
8
0 194
8
2
8
1 676
8
2
8
0 676
8
...

result:

ok 

Test #35:

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

input:

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

output:

8
0 201
8
1 201
8
0 810
8
0 201
8
2
8
1 201
8
1 810
8
0 429
8
1 429
8
0 29
8
0 429
8
2
8
0 810
8
2
8
0 201
8
2
8
1 201
8
1 810
8
1 429
8
1 29
8
0 733
8
1 733
8
0 265
8
0 733
8
2
8
1 733
8
1 265
8
0 73
8
1 73
8
0 558
8
0 73
8
2
8
0 265
8
2
8
0 733
8
2
8
0 29
8
2
8
0 429
8
2
8
0 810
8
2
8
1 558
8
2
8
...

result:

ok 

Test #36:

score: 15
Accepted
time: 19ms
memory: 3904kb

input:

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

output:

8
0 906
8
1 906
8
0 807
8
0 906
8
2
8
1 906
8
1 807
8
0 765
8
1 765
8
0 520
8
0 765
8
2
8
0 807
8
2
8
0 906
8
2
8
1 520
8
2
8
0 520
8
1 906
8
1 807
8
1 765
8
1 520
8
0 332
8
1 332
8
0 369
8
0 332
8
2
8
1 332
8
1 369
8
0 116
8
1 116
8
0 3
8
0 116
8
2
8
0 369
8
2
8
0 332
8
2
8
0 520
8
2
8
0 765
8
2
8
...

result:

ok 

Test #37:

score: 15
Accepted
time: 25ms
memory: 4104kb

input:

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

output:

8
0 381
8
1 381
8
0 493
8
0 381
8
2
8
1 381
8
1 493
8
0 77
8
1 77
8
0 740
8
0 77
8
2
8
0 493
8
2
8
0 381
8
2
8
1 381
8
1 493
8
1 77
8
1 740
8
0 959
8
1 959
8
0 968
8
0 959
8
2
8
1 959
8
1 968
8
0 90
8
1 90
8
0 545
8
0 90
8
2
8
0 968
8
2
8
0 959
8
2
8
0 740
8
2
8
0 77
8
2
8
1 545
8
2
8
0 545
8
1 90
8...

result:

ok 

Test #38:

score: 15
Accepted
time: 19ms
memory: 4140kb

input:

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

output:

8
0 358
8
1 358
8
0 881
8
0 358
8
2
8
1 358
8
1 881
8
0 103
8
1 103
8
0 562
8
0 103
8
2
8
0 881
8
2
8
1 562
8
2
8
0 562
8
1 103
8
2
8
0 103
8
1 881
8
0 358
8
2
8
1 562
8
2
8
0 562
8
1 358
8
1 103
8
1 562
8
0 90
8
1 90
8
0 280
8
0 90
8
2
8
1 90
8
1 280
8
0 172
8
1 172
8
0 271
8
0 172
8
2
8
0 280
8
2
...

result:

ok 

Test #39:

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

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

output:

8
0 590
8
1 590
8
0 83
8
0 590
8
2
8
1 590
8
1 83
8
0 249
8
1 249
8
0 250
8
0 249
8
2
8
0 83
8
2
8
0 590
8
2
8
1 590
8
1 83
8
1 249
8
1 250
8
0 64
8
1 64
8
0 670
8
0 64
8
2
8
1 64
8
1 670
8
0 739
8
1 739
8
0 72
8
0 739
8
2
8
0 670
8
2
8
0 64
8
2
8
0 250
8
2
8
0 249
8
2
8
0 83
8
2
8
0 590
8
2
8
1 590...

result:

ok 

Test #40:

score: 0
Wrong Answer
time: 68ms
memory: 3900kb

input:

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

output:

8
0 402
8
1 402
8
0 534
8
0 402
8
2
8
1 402
8
1 534
8
0 589
8
1 589
8
0 682
8
0 589
8
2
8
0 534
8
2
8
0 402
8
2
8
1 402
8
1 534
8
1 589
8
1 682
8
0 129
8
1 129
8
0 260
8
0 129
8
2
8
1 129
8
1 260
8
0 771
8
1 771
8
0 719
8
0 771
8
2
8
0 260
8
2
8
0 129
8
2
8
0 682
8
2
8
0 589
8
2
8
0 534
8
2
8
0 402
...

result:

wrong answer Too many queries.

Subtask #3:

score: 0
Wrong Answer

Test #43:

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

input:

2
2
1

output:

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

result:

ok 

Test #44:

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

input:

2
1

output:

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

result:

ok 

Test #45:

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

input:

3
1
2
1
1

output:

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

result:

ok 

Test #46:

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

input:

6
2
1
2
1
1
1
2
1
2
1

output:

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

result:

ok 

Test #47:

score: 73.29
Acceptable Answer
time: 0ms
memory: 4100kb

input:

10
1
1
2
1
1
2
1
2
2
1
2
1
1
1
2
1
2
2
1
2
2
1
2
1

output:

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

result:

points 0.97720 points  0.97720

Test #48:

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

input:

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

output:

8
0 1654
8
1 1654
8
0 1258
8
0 1654
8
2
8
1 1258
8
2
8
0 1258
8
1 1654
8
1 1258
8
0 921
8
1 921
8
0 1349
8
0 921
8
2
8
1 1349
8
2
8
0 1349
8
1 921
8
0 1258
8
2
8
1 1349
8
2
8
0 1349
8
1 1258
8
1 1349
8
0 1546
8
1 1546
8
0 1057
8
0 1546
8
2
8
1 1057
8
2
8
0 1057
8
1 1546
8
1 1057
8
0 731
8
1 731
8
0 ...

result:

ok 

Test #49:

score: 49.52
Acceptable Answer
time: 27ms
memory: 4288kb

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 829
8
1 829
8
0 1333
8
0 829
8
2
8
1 829
8
1 1333
8
0 67
8
1 67
8
0 1043
8
0 67
8
2
8
0 1333
8
2
8
0 829
8
2
8
1 829
8
1 1333
8
1 67
8
1 1043
8
0 1041
8
1 1041
8
0 1173
8
0 1041
8
2
8
1 1041
8
1 1173
8
0 1533
8
1 1533
8
0 1157
8
0 1533
8
2
8
0 1173
8
2
8
0 1041
8
2
8
0 1043
8
2
8
0 67
8
2
8
0 13...

result:

points 0.66026666670 points  0.66026666670

Test #50:

score: 13.63
Acceptable Answer
time: 53ms
memory: 3936kb

input:

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

output:

8
0 524
8
1 524
8
0 198
8
0 524
8
2
8
1 524
8
1 198
8
0 1225
8
1 1225
8
0 296
8
0 1225
8
2
8
0 198
8
2
8
0 524
8
2
8
1 524
8
1 198
8
1 1225
8
1 296
8
0 1003
8
1 1003
8
0 1114
8
0 1003
8
2
8
1 1003
8
1 1114
8
0 1258
8
1 1258
8
0 676
8
0 1258
8
2
8
0 1114
8
2
8
0 1003
8
2
8
0 296
8
2
8
0 1225
8
2
8
0 ...

result:

points 0.18173333330 points  0.18173333330

Test #51:

score: 14.33
Acceptable Answer
time: 80ms
memory: 3864kb

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

output:

8
0 1497
8
1 1497
8
0 616
8
0 1497
8
2
8
1 1497
8
1 616
8
0 1131
8
1 1131
8
0 200
8
0 1131
8
2
8
0 616
8
2
8
0 1497
8
2
8
1 1497
8
1 616
8
1 1131
8
1 200
8
0 473
8
1 473
8
0 1052
8
0 473
8
2
8
1 473
8
1 1052
8
0 13
8
1 13
8
0 910
8
0 13
8
2
8
0 1052
8
2
8
0 473
8
2
8
0 200
8
2
8
0 1131
8
2
8
0 616
8...

result:

points 0.19106666670 points  0.19106666670

Test #52:

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

input:

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

output:

8
0 1227
8
1 1227
8
0 612
8
0 1227
8
2
8
1 612
8
2
8
0 612
8
1 1227
8
1 612
8
0 542
8
1 542
8
0 1079
8
0 542
8
2
8
1 1079
8
2
8
0 1079
8
1 542
8
0 612
8
2
8
1 1079
8
2
8
0 1079
8
1 612
8
1 1079
8
0 1499
8
1 1499
8
0 1636
8
0 1499
8
2
8
1 1636
8
2
8
0 1636
8
1 1499
8
1 1636
8
0 1131
8
1 1131
8
0 856
...

result:

ok 

Test #53:

score: 63.2
Acceptable Answer
time: 0ms
memory: 4088kb

input:

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

output:

8
0 1928
8
1 1928
8
0 426
8
0 1928
8
2
8
1 1928
8
1 426
8
0 170
8
1 170
8
0 1978
8
0 170
8
2
8
0 426
8
2
8
0 1928
8
2
8
1 1928
8
1 426
8
1 170
8
1 1978
8
0 354
8
1 354
8
0 1509
8
0 354
8
2
8
1 1509
8
2
8
0 1509
8
1 354
8
1 1509
8
0 89
8
1 89
8
0 1906
8
0 89
8
2
8
1 1906
8
2
8
0 1906
8
1 89
8
0 1509
...

result:

points 0.84266666670 points  0.84266666670

Test #54:

score: 66.36
Acceptable Answer
time: 12ms
memory: 4172kb

input:

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

output:

8
0 600
8
1 600
8
0 1774
8
0 600
8
2
8
1 1774
8
2
8
0 1774
8
1 600
8
1 1774
8
0 922
8
1 922
8
0 907
8
0 922
8
2
8
0 1774
8
2
8
1 1774
8
1 922
8
1 907
8
0 33
8
1 33
8
0 1866
8
0 33
8
2
8
1 33
8
1 1866
8
0 1672
8
1 1672
8
0 275
8
0 1672
8
2
8
0 1866
8
2
8
1 275
8
2
8
0 275
8
1 1672
8
2
8
0 1672
8
1 18...

result:

points 0.88480 points  0.88480

Test #55:

score: 14.11
Acceptable Answer
time: 59ms
memory: 3940kb

input:

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

output:

8
0 1346
8
1 1346
8
0 212
8
0 1346
8
2
8
1 1346
8
1 212
8
0 192
8
1 192
8
0 773
8
0 192
8
2
8
0 212
8
2
8
0 1346
8
2
8
1 1346
8
1 212
8
1 192
8
1 773
8
0 485
8
1 485
8
0 1022
8
0 485
8
2
8
1 485
8
1 1022
8
0 468
8
1 468
8
0 1463
8
0 468
8
2
8
0 1022
8
2
8
0 485
8
2
8
0 773
8
2
8
0 192
8
2
8
0 212
8
...

result:

points 0.18813333330 points  0.18813333330

Test #56:

score: 63.5
Acceptable Answer
time: 21ms
memory: 4024kb

input:

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

output:

8
0 189
8
1 189
8
0 1584
8
0 189
8
2
8
1 189
8
1 1584
8
0 1279
8
1 1279
8
0 1270
8
0 1279
8
2
8
0 1584
8
2
8
0 189
8
2
8
1 189
8
1 1584
8
1 1279
8
1 1270
8
0 1532
8
1 1532
8
0 1975
8
0 1532
8
2
8
1 1532
8
1 1975
8
0 1127
8
1 1127
8
0 528
8
0 1127
8
2
8
0 1975
8
2
8
0 1532
8
2
8
0 1270
8
2
8
1 528
8
...

result:

points 0.84666666670 points  0.84666666670

Test #57:

score: 51.9
Acceptable Answer
time: 11ms
memory: 3888kb

input:

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

output:

8
0 1667
8
1 1667
8
0 330
8
0 1667
8
2
8
1 1667
8
1 330
8
0 644
8
1 644
8
0 1903
8
0 644
8
2
8
0 330
8
2
8
0 1667
8
2
8
1 1667
8
1 330
8
1 644
8
1 1903
8
0 1389
8
1 1389
8
0 412
8
0 1389
8
2
8
1 1389
8
1 412
8
0 1468
8
1 1468
8
0 1024
8
0 1468
8
2
8
0 412
8
2
8
0 1389
8
2
8
0 1903
8
2
8
1 1024
8
2
8...

result:

points 0.6920 points  0.6920

Test #58:

score: 44.72
Acceptable Answer
time: 14ms
memory: 3948kb

input:

1997
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
1
1
1
1
1
1
1
2
1
1
1
1
1
1
2
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
1
2
1
1
2
2
2
2
2
1
2
2
2
2
2
2
1
1
2
1
1
1
1
1
1
2
2
1
2
2
2
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
1
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2...

output:

8
0 1554
8
1 1554
8
0 754
8
0 1554
8
2
8
1 1554
8
1 754
8
0 936
8
1 936
8
0 376
8
0 936
8
2
8
0 754
8
2
8
0 1554
8
2
8
1 1554
8
1 754
8
1 936
8
1 376
8
0 48
8
1 48
8
0 122
8
0 48
8
2
8
1 48
8
1 122
8
0 1342
8
1 1342
8
0 1518
8
0 1342
8
2
8
0 122
8
2
8
0 48
8
2
8
0 376
8
2
8
0 936
8
2
8
0 754
8
2
8
0...

result:

points 0.59626666670 points  0.59626666670

Test #59:

score: 38.54
Acceptable Answer
time: 7ms
memory: 3988kb

input:

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

output:

8
0 1089
8
1 1089
8
0 1952
8
0 1089
8
2
8
1 1089
8
1 1952
8
0 750
8
1 750
8
0 1371
8
0 750
8
2
8
0 1952
8
2
8
0 1089
8
2
8
1 1089
8
1 1952
8
1 750
8
1 1371
8
0 514
8
1 514
8
0 1056
8
0 514
8
2
8
1 514
8
1 1056
8
0 388
8
1 388
8
0 1600
8
0 388
8
2
8
0 1056
8
2
8
0 514
8
2
8
0 1371
8
2
8
0 750
8
2
8
0...

result:

points 0.51386666670 points  0.51386666670

Test #60:

score: 32.8
Acceptable Answer
time: 30ms
memory: 4160kb

input:

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

output:

8
0 1663
8
1 1663
8
0 1063
8
0 1663
8
2
8
1 1663
8
1 1063
8
0 1510
8
1 1510
8
0 960
8
0 1510
8
2
8
0 1063
8
2
8
0 1663
8
2
8
1 1663
8
1 1063
8
1 1510
8
1 960
8
0 1851
8
1 1851
8
0 443
8
0 1851
8
2
8
1 1851
8
1 443
8
0 1318
8
1 1318
8
0 636
8
0 1318
8
2
8
0 443
8
2
8
0 1851
8
2
8
0 960
8
2
8
1 636
8
...

result:

points 0.43733333330 points  0.43733333330

Test #61:

score: 26.61
Acceptable Answer
time: 23ms
memory: 4132kb

input:

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

output:

8
0 158
8
1 158
8
0 179
8
0 158
8
2
8
1 158
8
1 179
8
0 372
8
1 372
8
0 1985
8
0 372
8
2
8
0 179
8
2
8
0 158
8
2
8
1 158
8
1 179
8
1 372
8
1 1985
8
0 1894
8
1 1894
8
0 1061
8
0 1894
8
2
8
1 1894
8
1 1061
8
0 636
8
1 636
8
0 1733
8
0 636
8
2
8
0 1061
8
2
8
0 1894
8
2
8
0 1985
8
2
8
0 372
8
2
8
1 1733...

result:

points 0.35480 points  0.35480

Test #62:

score: 12.54
Acceptable Answer
time: 56ms
memory: 4176kb

input:

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

output:

8
0 1682
8
1 1682
8
0 843
8
0 1682
8
2
8
1 1682
8
1 843
8
0 1992
8
1 1992
8
0 157
8
0 1992
8
2
8
0 843
8
2
8
1 157
8
2
8
0 157
8
1 843
8
0 1682
8
2
8
1 1682
8
1 1992
8
1 157
8
0 1686
8
1 1686
8
0 1922
8
0 1686
8
2
8
1 1686
8
1 1922
8
0 557
8
1 557
8
0 1929
8
0 557
8
2
8
0 1922
8
2
8
0 1686
8
2
8
0 1...

result:

points 0.16720 points  0.16720

Test #63:

score: 0
Wrong Answer
time: 92ms
memory: 3936kb

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

output:

8
0 1845
8
1 1845
8
0 1620
8
0 1845
8
2
8
1 1845
8
1 1620
8
0 435
8
1 435
8
0 532
8
0 435
8
2
8
0 1620
8
2
8
0 1845
8
2
8
1 1845
8
1 1620
8
1 435
8
1 532
8
0 69
8
1 69
8
0 513
8
0 69
8
2
8
1 69
8
1 513
8
0 155
8
1 155
8
0 875
8
0 155
8
2
8
0 513
8
2
8
0 69
8
2
8
0 532
8
2
8
0 435
8
2
8
0 1620
8
2
8
...

result:

wrong answer Too many queries.