QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#793841#4565. Rarest Insects_8_8_96.02 26ms4260kbC++201.7kb2024-11-30 02:25:082024-11-30 02:25:13

Judging History

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

  • [2024-11-30 02:25:13]
  • 评测
  • 测评结果:96.02
  • 用时:26ms
  • 内存:4260kb
  • [2024-11-30 02:25:08]
  • 提交

answer

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

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, u;
vector<int> p;
set<int> cur, lef;
void add(int i) {
    cur.insert(i);
    move_inside(i);
}
void del(int i) {
    if(cur.count(i)) {
        cur.erase(i);
        move_outside(i);
    }
}
int l , r;
bool check(int mid) {
    if(mid * u > n) return false;
    int col = 0;
    int val = (int)lef.size() + (int)cur.size();
    int it = 0;
    for(int i : lef) {
        add(i); 
        if(press_button() > mid) {
            del(i);
            col++;
        }
        it++;
    }
    if(col == val - mid * u) {
        set<int> nv;
        for(int i : lef) {
            if(!cur.count(i)) { 
                nv.insert(i);
            }
        }
        lef.swap(nv);
        return 1;
    }
    // l = max(l, mid - (col - val + mid * u));
    set<int> nv;
    for(int i : lef) {
        if(cur.count(i)) {
            nv.insert(i);
        }
        del(i);
    }
    lef.swap(nv);
    return false;
}
int min_cardinality(int NN) {
    n = NN;
    for(int i = 0; i < n; i++) {
        lef.insert(i);
    }
    for(int i = 0; i < n; i++) {
        add(i);
        if(press_button() == 2) {
            del(i);
        } else {
            lef.erase(i);
        }
    }
    u = (int)cur.size();
    l = 1, r = n + 1;
    // l + (r - l) / 3
    while(r - l > 1) {
        int mid = (l * 2 + r) / 3;
        if(r - l < 4) {
            mid = (l + r) >> 1;
        } else if(rng()% 3 == 0) {
            mid = (l + r) >> 1;
        }
        if(check(mid)) {
            l = mid;
        } else {
            r = mid;
        }
    }
    return l;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

6
1
1
1
2
2
2
2
2
3

output:

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

result:

ok 

Test #2:

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

input:

2
1
2
2

output:

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

result:

ok 

Test #3:

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

input:

2
1
1

output:

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

result:

ok 

Test #4:

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

input:

3
1
1
2

output:

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

result:

ok 

Test #5:

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

input:

5
1
1
2
2
2
2
2
3

output:

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

result:

ok 

Test #6:

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

input:

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

output:

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

result:

ok 

Test #7:

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

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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
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
...

result:

ok 

Test #9:

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

input:

200
1
1
1
2
1
2
1
2
2
2
1
1
1
1
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
1
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
1 3
8
0 4
8
2
8
0 5
8
2
8
1 5
8
0 6
8
2
8
0 7
8
2
8
1 7
8
0 8
8
2
8
1 8
8
0 9
8
2
8
1 9
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
0 18
8
2
8
1 18
8
0 19
8
2
8
1 19
8
0 20
8
2
8
1 20
8
0 21
...

result:

ok 

Test #10:

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

input:

198
1
1
1
1
1
1
2
1
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
1 6
8
0 7
8
2
8
0 8
8
2
8
1 8
8
0 9
8
2
8
1 9
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
0 13
8
2
8
1 13
8
0 14
8
2
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
0 18
8
2
8
1 18
8
0 19
8
2
8
1 19
8
0 20
8
2
8
1 2...

result:

ok 

Test #11:

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

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
0 4
8
2
8
1 4
8
0 5
8
2
8
1 5
8
0 6
8
2
8
1 6
8
0 7
8
2
8
1 7
8
0 8
8
2
8
1 8
8
0 9
8
2
8
1 9
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
0 18
8...

result:

ok 

Test #12:

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

input:

197
1
1
1
2
1
2
1
1
1
2
1
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
2
8
1 8
8
0 9
8
2
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
0 18
8
2
8
1 18
8
...

result:

ok 

Test #14:

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

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
1 6
8
0 7
8
2
8
1 7
8
0 8
8
2
8
1 8
8
0 9
8
2
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
1 17
8
0 18
8
2
8
1 18
8
0 19
8
2
8
0 20
8
2
8
1 20
8
0 2...

result:

ok 

Test #15:

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

input:

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

result:

ok 

Test #17:

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

input:

199
1
1
1
1
2
1
2
2
2
2
1
2
1
2
2
2
2
1
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
1 4
8
0 5
8
2
8
0 6
8
2
8
1 6
8
0 7
8
2
8
1 7
8
0 8
8
2
8
1 8
8
0 9
8
2
8
1 9
8
0 10
8
2
8
0 11
8
2
8
1 11
8
0 12
8
2
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
1 19
8
0 20
8
2
8
1 20
...

result:

ok 

Test #18:

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

input:

196
1
1
2
1
1
2
2
1
2
2
1
1
2
1
2
2
2
2
2
2
1
1
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 0
8
2
8
0 1
8
2
8
0 2
8
2
8
1 2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
1 5
8
0 6
8
2
8
1 6
8
0 7
8
2
8
0 8
8
2
8
1 8
8
0 9
8
2
8
1 9
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
1 12
8
0 13
8
2
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
0 18
8
2
8
1 18
8
0 19
8
2
8
1 19
8
0 20
8
2
...

result:

ok 

Test #19:

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

input:

196
1
1
2
1
1
2
1
1
1
1
1
1
2
2
2
2
2
2
1
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
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
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 0
8
2
8
0 1
8
2
8
0 2
8
2
8
1 2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
1 5
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
0 18
8
2
8
0 19
8
2
8
1 19
8
0 20
8
2
8
1 20
8
0 21
8
2
...

result:

ok 

Test #20:

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

input:

196
1
1
1
2
1
1
1
1
1
2
2
1
2
2
1
1
2
2
2
2
2
1
2
2
2
2
2
2
1
1
1
2
2
2
2
2
1
2
2
2
2
2
1
2
1
1
2
2
2
2
2
2
1
2
2
2
2
2
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0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
1 22
8
0 23
8
2
8
1 23...

result:

ok 

Test #22:

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

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
1 19
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27...

result:

ok 

Test #23:

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

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

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

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

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 0
8
2
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
0 4
8
2
8
1 4
8
0 5
8
2
8
1 5
8
0 6
8
2
8
1 6
8
0 7
8
2
8
1 7
8
0 8
8
2
8
1 8
8
0 9
8
2
8
1 9
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
...

result:

ok 

Test #25:

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

input:

1000
1
1
1
1
1
1
1
1
1
1
1
1
1
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
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
1 22
8
0 23
8
2
8
1 23
8
0 24
8
2
8...

result:

ok 

Test #27:

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

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
1 5
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
1 9
8
0 10
8
2
8
1 10
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
1 14
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
1 20
8
0 21
8
2
8
1 21
8
0 22
8
2
8
0 23
8
2
8
1 23...

result:

ok 

Test #28:

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

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

result:

ok 

Test #30:

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

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
1 2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
1 5
8
0 6
8
2
8
1 6
8
0 7
8
2
8
1 7
8
0 8
8
2
8
1 8
8
0 9
8
2
8
1 9
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
0 18
8
2
8
1 18
8
...

result:

ok 

Test #31:

score: 15
Accepted
time: 4ms
memory: 4000kb

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
1 5
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
1 8
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
1 19
8
0 20
8
2
8
0 21
8
2
8
1 21
8
0 22
8
2
8
1 22
8
0 23
8
2...

result:

ok 

Test #32:

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

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
0 4
8
2
8
0 5
8
2
8
1 5
8
0 6
8
2
8
1 6
8
0 7
8
2
8
0 8
8
2
8
1 8
8
0 9
8
2
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
0 18
8
2
8
1 18
8
0 19
8...

result:

ok 

Test #33:

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

input:

996
1
1
1
1
2
2
1
2
2
1
2
2
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
0 18
8
2
8
1 18
8
0 19
8
2
8
1 19
8
0...

result:

ok 

Test #35:

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

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
1 5
8
0 6
8
2
8
1 6
8
0 7
8
2
8
0 8
8
2
8
1 8
8
0 9
8
2
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
0 18
8
2
8
1 18
8
0 19
8
2
8
1 19
8
0 20
8
2
8
1 20
8
0 2...

result:

ok 

Test #36:

score: 15
Accepted
time: 4ms
memory: 3844kb

input:

997
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
0 18
8
2
8
0 19
8
2
8
1 19
8
0 20
8
2
8
1 20
8
0 21
8
2
8
1 2...

result:

ok 

Test #37:

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

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
1 5
8
0 6
8
2
8
1 6
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
1 9
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
1 13
8
0 14
8
2
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
0 18
8
2
8
0 19
8
2
8
1 19
8
0 20
8
2
8
0 21
8
2
8
1 21
8
0 22
8...

result:

ok 

Test #38:

score: 15
Accepted
time: 26ms
memory: 4012kb

input:

997
1
1
1
1
1
1
1
1
2
1
2
2
1
1
2
1
1
1
1
1
1
2
2
1
1
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
8
2
8
1 14
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
1 17
8
0 18
8
2
8
0 19
8
2
8
1 19
8
0 20
8
2
8
0 21
8
2
8
1 21
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
...

result:

ok 

Test #40:

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

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
1 10
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
1 16
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
1 22
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0...

result:

ok 

Test #41:

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

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
...

result:

ok 

Test #42:

score: 15
Accepted
time: 4ms
memory: 3892kb

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
...

result:

ok 

Subtask #3:

score: 71.02
Acceptable Answer

Test #43:

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

input:

2
1
2
2

output:

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

result:

ok 

Test #44:

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

input:

2
1
1

output:

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

result:

ok 

Test #45:

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

input:

3
1
1
2

output:

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

result:

ok 

Test #46:

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

input:

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

output:

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

result:

ok 

Test #47:

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

input:

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

output:

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

result:

ok 

Test #48:

score: 71.02
Acceptable Answer
time: 3ms
memory: 4048kb

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 0
8
2
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
0 4
8
2
8
1 4
8
0 5
8
2
8
1 5
8
0 6
8
2
8
1 6
8
0 7
8
2
8
1 7
8
0 8
8
2
8
1 8
8
0 9
8
2
8
1 9
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
...

result:

points 0.94693333330 points  0.94693333330

Test #49:

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

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 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
...

result:

ok 

Test #50:

score: 75
Accepted
time: 18ms
memory: 4032kb

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
1 8
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
1 21
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8...

result:

ok 

Test #51:

score: 73.17
Acceptable Answer
time: 13ms
memory: 4236kb

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
1 4
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
1 7
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
1 11
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
1 18
8
0 19
8
2
8
0 20
8
2
8
1 20
8
0 21
8
2
8
1 21
8
0 22
8
2
8
1 22
8
0 23
8
2...

result:

points 0.97560 points  0.97560

Test #52:

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

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 0
8
2
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
0 4
8
2
8
1 4
8
0 5
8
2
8
1 5
8
0 6
8
2
8
1 6
8
0 7
8
2
8
1 7
8
0 8
8
2
8
1 8
8
0 9
8
2
8
1 9
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
...

result:

ok 

Test #53:

score: 75
Accepted
time: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5
8
0 6
8
2
8
0 7
8
2
8
1 7
8
0 8
8
2
8
1 8
8
0 9
8
2
8
1 9
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
0 18
8
2
8
1 18
8
...

result:

ok 

Test #55:

score: 74.07
Acceptable Answer
time: 6ms
memory: 3944kb

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
1 6
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
1 12
8
0 13
8
2
8
0 14
8
2
8
1 14
8
0 15
8
2
8
0 16
8
2
8
1 16
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
1 19
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
1 22
8
0 23
8
2
8
1 2...

result:

points 0.98760 points  0.98760

Test #56:

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

input:

1998
1
1
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2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2
8
1 16
8
0 17
8
2
8
1 17
8
0 18
8
2
8
1 18
8
0 19
8
2
8
0 20
8
2...

result:

ok 

Test #58:

score: 74.09
Acceptable Answer
time: 11ms
memory: 3988kb

input:

1997
1
1
1
2
1
1
1
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
1 3
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
1 7
8
0 8
8
2
8
0 9
8
2
8
1 9
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
0 18
8
2
8
1 18
8
0 19
8
2
8
1 19
8
0 20
8
2
8
1 20
8
0 2...

result:

points 0.98786666670 points  0.98786666670

Test #59:

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

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
1 7
8
0 8
8
2
8
1 8
8
0 9
8
2
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
0 15
8
2
8
1 15
8
0 16
8
2
8
0 17
8
2
8
1 17
8
0 18
8
2
8
1 18
8
0 19
8
2
8
1 19
8
0 20
8
2
8
1 20
8
0 ...

result:

ok 

Test #60:

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

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
0 18
8
2
8
1 18
8
0 19
8
2
8
1 19
8
0 20
8
2
8
1 20
8
0 21
8
2
8
1 2...

result:

ok 

Test #61:

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

input:

2000
1
1
1
1
1
1
1
2
1
2
2
1
1
2
2
2
2
2
1
1
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
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
1 16
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
1 23
8
0 24
8
2
8
1 24
8
0 25
8...

result:

points 0.99386666670 points  0.99386666670

Test #63:

score: 71.47
Acceptable Answer
time: 4ms
memory: 4204kb

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
1 16
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
1 21
8
0 22
8
2
8
1 22
8
0 23
8
2
8
1 23
8
0 24
8
2
8
0 25
...

result:

points 0.95293333330 points  0.95293333330

Test #64:

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

input:

1995
1
1
1
1
1
1
1
1
2
1
2
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
1
1
1
1
1
2
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
2
1
1
1
1
1
2
1
1
1
1
1
2
1
2
1
1
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8
0 26
8
2
8
0 27
8
2
8
...

result:

ok 

Test #66:

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

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
...

result:

ok 

Test #67:

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

input:

1999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
...

result:

ok 

Test #68:

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

input:

1979
1
2
2
2
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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 0
8
2
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
0 4
8
2
8
1 4
8
0 5
8
2
8
1 5
8
0 6
8
2
8
1 6
8
0 7
8
2
8
1 7
8
0 8
8
2
8
1 8
8
0 9
8
2
8
1 9
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 1...

result:

ok 

Test #69:

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

input:

1979
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1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1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
...

result:

ok 

Test #71:

score: 74.64
Acceptable Answer
time: 17ms
memory: 3932kb

input:

1979
1
1
1
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
...

result:

points 0.99520 points  0.99520

Test #72:

score: 73.25
Acceptable Answer
time: 0ms
memory: 4020kb

input:

1981
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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 0
8
2
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
0 4
8
2
8
1 4
8
0 5
8
2
8
1 5
8
0 6
8
2
8
1 6
8
0 7
8
2
8
1 7
8
0 8
8
2
8
1 8
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
...

result:

points 0.97666666670 points  0.97666666670

Test #73:

score: 74.15
Acceptable Answer
time: 13ms
memory: 3924kb

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
1 13
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
1 22
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2...

result:

points 0.98866666670 points  0.98866666670

Test #74:

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

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
...

result:

ok 

Test #75:

score: 74.56
Acceptable Answer
time: 3ms
memory: 3936kb

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
1 1
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
...

result:

points 0.99413333330 points  0.99413333330

Test #76:

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

input:

1970
1
2
2
2
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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 0
8
2
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
0 4
8
2
8
1 4
8
0 5
8
2
8
1 5
8
0 6
8
2
8
1 6
8
0 7
8
2
8
1 7
8
0 8
8
2
8
1 8
8
0 9
8
2
8
1 9
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 1...

result:

ok 

Test #77:

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

input:

1970
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
2
1
1
2
1
2
1
2
1
1
1
1
2
1
1
1
1
2
2
1
1
1
1
1
2
1
2
1
2
2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13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
...

result:

points 0.96653333330 points  0.96653333330

Test #79:

score: 73.61
Acceptable Answer
time: 18ms
memory: 4004kb

input:

1980
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
...

result:

points 0.98146666670 points  0.98146666670

Test #80:

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

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
0 4
8
2
8
1 4
8
0 5
8
2
8
1 5
8
0 6
8
2
8
1 6
8
0 7
8
2
8
1 7
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 ...

result:

ok 

Test #81:

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

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
0 4
8
2
8
1 4
8
0 5
8
2
8
1 5
8
0 6
8
2
8
1 6
8
0 7
8
2
8
1 7
8
0 8
8
2
8
1 8
8
0 9
8
2
8
1 9
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 1...

result:

ok 

Test #82:

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

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
1 3
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
0 18
8
2
8
1 18
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8...

result:

ok 

Test #83:

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

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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
...

result:

ok 

Test #84:

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

input:

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

output:

8
0 0
8
2
8
0 1
8
2
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
0 4
8
2
8
1 4
8
0 5
8
2
8
1 5
8
0 6
8
2
8
1 6
8
0 7
8
2
8
1 7
8
0 8
8
2
8
1 8
8
0 9
8
2
8
1 9
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
0 18
8...

result:

ok 

Test #85:

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

input:

1834
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2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14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
0 18
8...

result:

points 0.95346666670 points  0.95346666670

Test #87:

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

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 0
8
2
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
0 4
8
2
8
1 4
8
0 5
8
2
8
1 5
8
0 6
8
2
8
1 6
8
0 7
8
2
8
1 7
8
0 8
8
2
8
1 8
8
0 9
8
2
8
1 9
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
...

result:

ok 

Test #88:

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

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 0
8
2
8
0 1
8
2
8
0 2
8
2
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
0 6
8
2
8
0 7
8
2
8
0 8
8
2
8
0 9
8
2
8
0 10
8
2
8
0 11
8
2
8
0 12
8
2
8
0 13
8
2
8
0 14
8
2
8
0 15
8
2
8
0 16
8
2
8
0 17
8
2
8
0 18
8
2
8
0 19
8
2
8
0 20
8
2
8
0 21
8
2
8
0 22
8
2
8
0 23
8
2
8
0 24
8
2
8
0 25
8
2
8
0 26
8
2
8
0 27
8
2
8
...

result:

ok 

Test #89:

score: 75
Accepted
time: 20ms
memory: 4156kb

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 0
8
2
8
0 1
8
2
8
1 1
8
0 2
8
2
8
1 2
8
0 3
8
2
8
1 3
8
0 4
8
2
8
1 4
8
0 5
8
2
8
1 5
8
0 6
8
2
8
1 6
8
0 7
8
2
8
1 7
8
0 8
8
2
8
1 8
8
0 9
8
2
8
1 9
8
0 10
8
2
8
1 10
8
0 11
8
2
8
1 11
8
0 12
8
2
8
1 12
8
0 13
8
2
8
1 13
8
0 14
8
2
8
1 14
8
0 15
8
2
8
1 15
8
0 16
8
2
8
1 16
8
0 17
8
2
8
1 17
8
...

result:

ok