QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#793026#4565. Rarest Insects_8_8_#10 70ms4396kbC++201.3kb2024-11-29 15:59:462024-11-29 15:59:46

Judging History

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

  • [2024-11-29 15:59:46]
  • 评测
  • 测评结果:10
  • 用时:70ms
  • 内存:4396kb
  • [2024-11-29 15:59:46]
  • 提交

answer

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

using namespace std;

int n;
set<int> cur;

void add(int i) {
    move_inside(i);
    cur.insert(i);
}
void del(int i) {
    move_outside(i);
    cur.erase(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]);
        }
    }
    // for(int j : cur) {
    //     cout << j << ' ';
    // }
    // cout << '\n';
    return ret;
}
int min_cardinality(int NN) {
    n = NN;
    int res = (int)1e9;
    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: 3868kb

input:

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

result:

ok 

Test #2:

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

input:

2
2
1

output:

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

result:

ok 

Test #3:

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

input:

2
1

output:

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

result:

ok 

Test #4:

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

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 #5:

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

input:

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

result:

ok 

Test #6:

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

input:

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

result:

ok 

Test #23:

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

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

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

result:

ok 

Subtask #2:

score: 0
Wrong Answer

Test #24:

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

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

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

result:

wrong answer Too many queries.

Subtask #3:

score: 0
Wrong Answer

Test #43:

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

input:

2
2
1

output:

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

result:

ok 

Test #44:

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

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

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: 1ms
memory: 4076kb

input:

6
2
1
1
2
1
2
1
1
2
1

output:

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

result:

ok 

Test #47:

score: 73.74
Acceptable Answer
time: 1ms
memory: 4068kb

input:

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

result:

points 0.98320 points  0.98320

Test #48:

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

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

result:

ok 

Test #49:

score: 49.52
Acceptable Answer
time: 18ms
memory: 4396kb

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

result:

points 0.66026666670 points  0.66026666670

Test #50:

score: 13.92
Acceptable Answer
time: 54ms
memory: 3860kb

input:

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

result:

points 0.18746666670 points  0.18746666670

Test #52:

score: 74.99
Acceptable Answer
time: 8ms
memory: 3912kb

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

result:

points 0.99986666670 points  0.99986666670

Test #53:

score: 63.09
Acceptable Answer
time: 13ms
memory: 3984kb

input:

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

result:

points 0.88440 points  0.88440

Test #55:

score: 14.07
Acceptable Answer
time: 61ms
memory: 3864kb

input:

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

result:

points 0.18760 points  0.18760

Test #56:

score: 63.17
Acceptable Answer
time: 24ms
memory: 3932kb

input:

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

result:

points 0.68626666670 points  0.68626666670

Test #58:

score: 43.59
Acceptable Answer
time: 10ms
memory: 4092kb

input:

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

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

result:

points 0.58120 points  0.58120

Test #59:

score: 38.39
Acceptable Answer
time: 28ms
memory: 3728kb

input:

1998
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
2
2
1
1
1
1
2
1
1
1
1
1
2
2
2
2
1
1
2
2
2
2
2
2
1
2
1
2
2
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
2
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
1
1
1
2
2
1
2
2
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
8
1 4
8
1 5
8
1 6
8
1 7
8
0 8
8
1 8
...

result:

points 0.44573333330 points  0.44573333330

Test #61:

score: 26.05
Acceptable Answer
time: 28ms
memory: 3832kb

input:

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

result:

points 0.34733333330 points  0.34733333330

Test #62:

score: 12.59
Acceptable Answer
time: 58ms
memory: 3860kb

input:

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

result:

points 0.16786666670 points  0.16786666670

Test #63:

score: 0
Wrong Answer
time: 70ms
memory: 3788kb

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

result:

wrong answer Too many queries.