QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#69560#5305. Oscar is All You NeedmagicduckAC ✓5ms3580kbC++143.5kb2022-12-28 18:15:412022-12-28 18:15:43

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-12-28 18:15:43]
  • 评测
  • 测评结果:AC
  • 用时:5ms
  • 内存:3580kb
  • [2022-12-28 18:15:41]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
template <typename T> inline void read(T &F) {
    int R = 1; F = 0; char CH = getchar();
    for(; !isdigit(CH); CH = getchar()) if(CH == '-') R = -1;
    for(; isdigit(CH); CH = getchar()) F = F * 10 + CH - 48;
    F *= R;
}
inline void file(string str) {
    freopen((str + ".in").c_str(), "r", stdin);
    freopen((str + ".out").c_str(), "w", stdout);
}
const int N = 1e3 + 10;
int p[N], q[N], len; vector<pair<int, int> > R;
vector<int> calc(vector<int> P, int x, int y) {
    vector<int> R;
    for(int i = y; i >= 1; i--)
        R.emplace_back(P[P.size() - i]);
    for(int i = x; i < P.size() - y; i++) R.emplace_back(P[i]);
    for(int i = 0; i < x; i++) R.emplace_back(P[i]);
    return R;
}
vector<int> wrk(vector<int> P, int x, int y) {
    int a = 0, b = 0;
    for(int i = 0; i < x; i++) a += P[i];
    for(int i = P.size() - y; i < P.size(); i++) b += P[i];
    int tot = 0;
    for(int i = len - b + 1; i <= len; i++) q[++tot] = p[i];
    for(int i = a + 1; i <= len - b; i++) q[++tot] = p[i];
    for(int i = 1; i <= a; i++) q[++tot] = p[i];
    for(int i = 1; i <= len; i++) p[i] = q[i];
    R.emplace_back(a, b); return calc(P, x, y);
}
int main() {
    //file("");
    int n = 4; map<vector<int>, vector<pair<int, int> > > G;
    vector<int> B;
    for(int i = 1; i <= n; i++)
        B.emplace_back(i);
    G[B] = {}; queue<vector<int> > q; q.push(B);
    while(!q.empty()) {
        auto T = q.front(); q.pop();
        const auto S = G[T];
        for(int x = 1; x < n; x++)
            for(int y = 1; x + y < n; y++) {
                auto C = calc(T, x, y);
                if(G.find(C) == G.end()) {
                    G[C] = S; G[C].emplace_back(x, y);
                    q.push(C);
                }
            }
    }
    int T; read(T);
    while(T--) {
        read(len);
        for(int i = 1; i <= len; i++) read(p[i]);
        if(len == 3) {
            if(p[1] > p[3]) cout << 1 << '\n' << 1 << ' ' << 1 << '\n';
            else puts("0"); continue;
        }
        R.clear();
        if(p[1] != 1) {
            vector<int> T; vector<pair<int, int> > op;
            if(p[2] == 1) op = G[{2, 1, 4, 3}], T = {1, 1, 1, len - 3};
            else if(p[len] == 1) op = G[{4, 2, 3, 1}], T = {1, 1, len - 3, 1};
            else {
                int id = 0;
                for(int i = 2; i <= len; i++) if(p[i] == 1) id = i;
                op = G[{3, 1, 2, 4}], T = {1, id - 2, 1, len - id};
            }
            for(auto i : op) T = wrk(T, i.first, i.second);
        }
        for(int i = 2; i <= len - 2; i++) {
            int id = 0;
            for(int j = i; j <= len; j++)
                if(p[j] == i) id = j;
            vector<int> T; vector<pair<int, int> > op;
            if(id == i) continue;
            else if(id == len) op = G[{1, 4, 2, 3}], T = {i - 1, 1, len - i - 1, 1};
            else op = G[{1, 3, 4, 2}], T = {i - 1, id - i, 1, len - id};
            for(auto i : op) T = wrk(T, i.first, i.second);
        }
        if(p[len] != len) {
            vector<int> T = {len - 3, 1, 1, 1}; auto op = G[{1, 2, 4, 3}];
            for(auto i : op) T = wrk(T, i.first, i.second);
        }
        cout << R.size() << '\n';
        for(auto i : R) cout << i.first << " " << i.second << '\n';
     }
    #ifdef _MagicDuck
        fprintf(stderr, "# Time: %.3lf s", (double)clock() / CLOCKS_PER_SEC);
    #endif
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 3452kb

input:

2
3
1 3 2
5
4 1 2 3 5

output:

0
11
1 3
1 2
1 3
2 1
2 1
2 2
2 1
1 3
1 1
3 1
1 2

result:

ok OK in maximum 11 operations

Test #2:

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

input:

120
3
1 3 2
3
3 2 1
3
2 3 1
5
1 2 3 4 5
12
11 9 2 8 3 10 6 1 4 7 5 12
36
24 9 7 3 31 15 13 1 4 33 11 29 16 23 2 25 35 21 32 14 6 18 17 26 28 8 27 22 20 36 10 19 34 12 30 5
4
4 2 3 1
5
3 5 2 1 4
4
1 2 4 3
10
5 7 4 9 6 8 1 3 10 2
5
3 1 5 2 4
5
3 5 1 2 4
3
3 1 2
13
3 1 2 11 12 13 8 6 5 4 10 9 7
16
12 8...

output:

0
1
1 1
1
1 1
0
21
1 4
4 2
1 8
10 1
2 8
9 2
3 6
8 3
4 6
7 4
5 1
6 5
7 1
4 7
8 3
2 8
9 1
1 10
1 1
10 1
1 9
66
1 28
28 2
1 21
34 1
2 9
33 2
3 29
32 3
4 6
31 4
5 14
30 5
6 13
29 6
7 11
28 7
8 17
27 8
9 5
26 9
10 16
25 10
11 6
24 11
12 19
23 12
13 14
22 13
14 8
21 14
15 18
20 15
16 13
19 16
17 18
17 17
...

result:

ok OK in maximum 1 operations

Test #3:

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

input:

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

output:

6
1 4
6 1
2 3
5 2
3 3
4 3
26
1 1
1 5
13 1
2 8
12 2
3 6
11 3
4 9
10 4
5 2
9 5
6 3
8 6
8 4
6 8
9 4
5 9
10 4
3 10
11 2
3 11
12 1
1 13
1 1
13 1
1 12
1
1 1
10
1 2
2 2
1 2
6 1
2 1
5 2
4 1
3 4
5 1
2 5
8
1 1
1 2
1 1
1 1
1 2
1 1
2 1
1 1
10
1 3
3 2
2 5
4 2
3 2
4 3
4 1
3 4
5 2
1 5
6
1 1
1 2
1 1
3 1
2 1
2 2
4
1...

result:

ok OK in maximum 0 operations

Test #4:

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

input:

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

output:

0
1
1 1
0
1
1 1
0
1
1 1

result:

ok OK in maximum 1 operations

Test #5:

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

input:

24
4
1 2 4 3
4
3 2 4 1
4
4 1 3 2
4
3 1 2 4
4
2 3 4 1
4
3 2 1 4
4
2 4 1 3
4
3 4 1 2
4
4 2 1 3
4
2 1 4 3
4
4 3 2 1
4
2 3 1 4
4
1 2 3 4
4
1 3 2 4
4
3 1 4 2
4
4 1 2 3
4
4 3 1 2
4
1 4 3 2
4
3 4 2 1
4
1 4 2 3
4
4 2 3 1
4
1 3 4 2
4
2 1 3 4
4
2 4 3 1

output:

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

result:

ok OK in maximum 8 operations

Test #6:

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

input:

120
5
5 2 4 3 1
5
2 4 5 1 3
5
3 2 5 4 1
5
5 1 3 2 4
5
4 5 2 3 1
5
2 4 3 1 5
5
3 1 5 2 4
5
1 4 2 5 3
5
2 5 1 4 3
5
4 1 2 5 3
5
3 1 2 4 5
5
1 3 5 2 4
5
5 4 2 3 1
5
2 3 5 1 4
5
5 4 3 2 1
5
2 1 4 3 5
5
3 5 2 4 1
5
1 5 4 2 3
5
3 1 4 5 2
5
4 2 3 1 5
5
3 4 1 2 5
5
4 5 1 2 3
5
2 4 5 3 1
5
4 5 1 3 2
5
2 3 1 ...

output:

8
1 1
2 1
2 2
2 1
1 3
1 1
3 1
1 2
4
1 1
1 2
2 2
1 2
8
1 1
2 2
1 2
2 1
1 3
1 1
3 1
1 2
11
1 3
1 2
1 2
3 1
2 1
2 2
2 1
1 3
1 1
3 1
1 2
3
1 1
1 2
3 1
9
1 1
1 2
2 1
2 2
2 1
1 3
1 1
3 1
1 2
6
1 3
1 2
1 2
3 1
2 2
1 2
4
1 2
3 1
2 1
2 2
9
1 2
2 2
2 2
1 2
2 1
1 3
1 1
3 1
1 2
6
1 3
1 2
1 3
2 1
2 2
1 2
4
1 3
1...

result:

ok OK in maximum 4 operations

Test #7:

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

input:

120
5
3 4 1 5 2
3
2 3 1
7
3 6 5 1 2 7 4
5
1 4 3 2 5
3
3 2 1
6
3 6 2 1 4 5
7
1 7 3 4 2 5 6
7
6 4 7 3 5 1 2
6
6 1 4 5 3 2
4
3 4 1 2
5
4 2 1 5 3
6
3 2 5 1 4 6
5
5 4 1 2 3
4
1 2 4 3
3
2 1 3
3
1 2 3
5
2 3 5 4 1
3
2 3 1
3
2 1 3
6
5 2 4 6 1 3
7
3 4 7 6 2 5 1
5
4 5 2 3 1
6
6 4 5 2 1 3
5
5 1 4 3 2
3
3 2 1
3
...

output:

4
1 2
2 2
1 3
2 1
1
1 1
15
1 3
3 2
1 2
5 1
2 2
4 2
3 3
2 3
4 1
2 4
4 1
1 5
1 1
5 1
1 4
9
1 1
3 1
2 2
1 2
2 1
1 3
1 1
3 1
1 2
1
1 1
8
1 2
2 2
1 2
4 1
2 1
3 2
3 1
2 3
4
1 2
5 1
2 1
4 2
10
1 1
1 2
1 5
4 1
2 1
4 2
3 1
3 3
4 1
2 4
11
1 4
1 2
1 1
4 1
2 3
2 2
3 1
1 4
1 1
4 1
1 3
4
1 1
1 2
1 2
1 1
6
1 2
2 2...

result:

ok OK in maximum 5 operations

Test #8:

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

input:

120
3
1 3 2
5
3 2 4 1 5
3
3 2 1
5
3 4 1 5 2
5
1 3 2 5 4
3
2 3 1
3
2 3 1
4
3 4 1 2
6
1 3 2 4 6 5
5
2 5 1 3 4
3
2 1 3
4
4 3 1 2
5
5 3 4 1 2
3
3 1 2
5
3 5 4 2 1
3
3 1 2
6
2 1 4 3 6 5
3
3 1 2
3
2 1 3
3
1 2 3
6
3 5 2 6 4 1
3
1 2 3
7
1 2 6 7 3 5 4
5
4 1 2 3 5
7
2 7 1 5 4 6 3
5
1 2 5 4 3
6
3 4 2 1 5 6
5
2 ...

output:

0
6
1 1
1 2
1 2
3 1
2 2
1 2
1
1 1
4
1 2
2 2
1 3
2 1
9
1 2
3 1
2 2
1 2
2 1
1 3
1 1
3 1
1 2
1
1 1
1
1 1
4
1 1
1 2
1 2
1 1
9
1 3
4 1
2 3
2 2
3 1
1 4
1 1
4 1
1 3
4
1 2
2 2
2 1
2 2
0
9
1 1
1 2
1 2
1 1
1 1
1 2
1 1
2 1
1 1
6
1 1
1 2
1 3
2 1
2 1
2 2
1
1 1
8
1 1
1 1
3 1
2 1
1 3
1 1
3 1
1 2
1
1 1
9
1 4
1 2
3 ...

result:

ok OK in maximum 4 operations

Test #9:

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

input:

120
3
3 2 1
3
2 1 3
5
3 4 2 5 1
6
1 5 3 6 2 4
4
2 4 3 1
3
1 2 3
7
1 4 3 2 7 5 6
3
1 2 3
6
2 1 6 4 3 5
5
4 1 5 2 3
3
2 3 1
4
3 4 2 1
7
3 5 6 4 7 1 2
7
2 4 7 1 6 5 3
5
4 1 3 2 5
5
2 3 4 5 1
5
3 2 1 5 4
5
2 3 1 4 5
6
5 6 1 2 4 3
5
1 5 4 3 2
7
6 5 4 7 3 1 2
6
5 4 2 1 6 3
4
2 1 3 4
5
1 4 5 3 2
6
4 2 3 6 ...

output:

1
1 1
0
5
1 1
1 2
3 1
2 1
2 2
6
1 1
4 1
2 1
3 2
3 1
2 3
8
1 1
1 2
1 1
1 1
1 2
1 1
2 1
1 1
0
8
1 3
5 1
2 4
3 2
3 3
2 3
4 1
2 4
0
6
1 4
1 2
2 2
3 2
3 2
1 3
9
1 3
1 2
1 2
3 1
2 1
1 3
1 1
3 1
1 2
1
1 1
3
1 1
1 1
2 1
8
1 1
1 2
1 5
4 1
3 1
3 3
4 1
2 4
11
1 3
3 2
2 4
3 2
4 2
1 4
4 1
1 5
1 1
5 1
1 4
6
1 3
1...

result:

ok OK in maximum 13 operations

Test #10:

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

input:

120
5
4 1 2 5 3
7
3 5 1 2 7 6 4
6
4 2 1 6 5 3
6
3 6 2 5 4 1
3
1 2 3
5
4 5 1 3 2
3
2 3 1
7
5 4 1 7 2 6 3
6
5 6 2 3 1 4
5
3 1 2 4 5
7
1 4 2 6 5 7 3
6
5 3 4 1 6 2
7
1 5 6 2 4 7 3
5
2 3 1 4 5
4
2 3 1 4
7
1 3 5 7 4 2 6
5
4 2 5 3 1
5
4 1 2 3 5
4
3 4 2 1
3
2 1 3
6
3 5 2 1 6 4
6
3 5 1 6 4 2
4
3 4 2 1
4
3 4 ...

output:

6
1 3
1 2
1 3
2 1
2 2
1 2
13
1 4
4 2
1 3
5 1
2 1
4 2
3 3
2 3
4 1
1 5
1 1
5 1
1 4
11
1 3
3 2
1 3
4 1
2 1
3 2
3 1
1 4
1 1
4 1
1 3
12
1 1
1 3
4 1
2 1
3 2
3 2
1 3
3 1
1 4
1 1
4 1
1 3
0
6
1 2
2 2
1 3
2 1
2 2
1 2
1
1 1
15
1 4
4 2
1 2
5 1
2 3
4 2
3 2
3 3
4 2
1 4
4 1
1 5
1 1
5 1
1 4
4
1 1
1 2
1 2
4 1
4
1 3
...

result:

ok OK in maximum 8 operations

Test #11:

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

input:

120
8
2 3 5 4 8 7 6 1
7
2 5 4 7 6 1 3
3
3 2 1
6
3 6 4 2 1 5
4
2 4 3 1
9
5 8 4 2 3 6 7 9 1
6
5 1 6 2 3 4
10
10 1 2 8 5 3 7 9 6 4
4
1 4 2 3
3
3 2 1
7
4 7 1 3 6 2 5
4
4 1 3 2
3
3 2 1
4
4 2 3 1
8
6 1 4 2 3 7 5 8
9
4 1 9 2 6 3 7 5 8
5
5 4 3 1 2
7
4 6 3 7 2 5 1
4
1 4 2 3
8
2 8 7 4 6 5 3 1
7
5 6 3 4 2 1 7
...

output:

14
1 1
1 6
5 1
3 3
4 3
4 3
2 4
5 2
1 5
5 1
1 6
1 1
6 1
1 5
13
1 1
1 2
2 4
3 2
3 2
3 3
4 2
1 4
4 1
1 5
1 1
5 1
1 4
1
1 1
8
1 1
1 2
1 1
4 1
2 2
3 2
3 1
2 3
8
1 1
1 2
1 1
1 1
1 2
1 1
2 1
1 1
14
1 1
1 5
7 1
3 5
4 3
4 1
4 4
5 2
3 5
6 1
1 7
1 1
7 1
1 6
9
1 4
1 2
1 3
4 1
3 1
1 4
1 1
4 1
1 3
16
1 8
1 2
1 8
...

result:

ok OK in maximum 17 operations

Test #12:

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

input:

120
5
2 3 5 1 4
9
4 9 7 1 2 3 8 6 5
8
4 8 2 3 1 6 7 5
6
2 5 3 6 1 4
4
4 1 2 3
3
1 2 3
3
2 1 3
9
9 7 2 6 3 4 5 1 8
3
1 3 2
8
3 1 2 7 5 4 8 6
7
2 7 1 6 4 3 5
5
1 2 3 4 5
4
3 2 1 4
8
2 1 3 8 4 7 6 5
10
7 9 8 1 5 3 4 10 6 2
10
8 10 7 5 3 9 1 4 6 2
7
1 4 3 5 7 6 2
7
5 3 2 4 1 6 7
6
1 6 2 5 3 4
5
4 3 5 1 ...

output:

7
1 1
1 2
2 1
1 3
1 1
3 1
1 2
12
1 5
5 2
1 4
7 1
3 2
5 3
4 4
3 4
5 3
2 5
6 1
2 6
10
1 3
3 2
1 4
6 1
3 1
4 3
4 3
2 4
5 1
2 5
6
1 1
1 2
2 2
3 2
3 1
2 3
9
1 2
1 2
1 2
1 1
1 1
1 2
1 1
2 1
1 1
0
0
10
1 1
1 2
1 5
7 1
2 5
6 2
5 3
2 5
6 2
1 6
0
10
1 6
1 2
1 6
5 1
3 2
4 3
4 3
2 4
5 1
2 5
11
1 4
4 2
2 1
4 2
3...

result:

ok OK in maximum 1 operations

Test #13:

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

input:

120
8
3 4 8 2 7 1 5 6
9
2 1 4 7 9 3 5 8 6
3
2 1 3
3
1 2 3
10
3 6 1 9 5 2 8 7 4 10
8
1 6 3 2 8 4 7 5
4
1 2 3 4
5
5 3 4 1 2
3
3 1 2
7
1 6 5 4 3 7 2
6
2 3 6 4 5 1
9
7 8 2 4 9 5 6 1 3
4
1 2 4 3
9
4 2 1 7 3 5 8 6 9
5
3 2 5 4 1
5
1 4 2 3 5
9
3 7 2 8 5 4 6 9 1
10
6 7 4 2 3 9 8 10 5 1
4
3 2 1 4
10
8 5 9 3 6...

output:

13
1 2
2 2
1 3
6 1
2 2
5 2
4 1
3 4
5 1
1 6
1 1
6 1
1 5
15
1 7
1 2
2 4
6 2
3 2
5 3
4 2
4 4
5 2
3 5
6 1
1 7
1 1
7 1
1 6
0
0
21
1 7
7 2
1 4
8 1
2 3
7 2
3 1
6 3
4 2
5 4
5 1
4 5
6 1
3 6
7 2
1 7
7 1
1 8
1 1
8 1
1 7
13
1 4
6 1
2 5
4 2
3 3
4 3
4 2
3 4
5 1
1 6
1 1
6 1
1 5
0
6
1 1
1 2
1 3
2 1
2 1
2 2
1
1 1
13...

result:

ok OK in maximum 0 operations

Test #14:

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

input:

120
4
4 1 3 2
8
3 8 5 2 6 4 1 7
9
6 4 3 8 2 9 1 5 7
8
4 5 3 2 6 7 8 1
10
2 1 3 8 6 5 9 4 7 10
5
4 1 2 3 5
4
2 1 3 4
6
1 5 6 2 3 4
4
1 3 4 2
8
7 1 6 2 3 5 4 8
7
3 2 5 1 7 4 6
5
1 3 2 4 5
6
5 1 3 2 4 6
8
6 5 2 7 8 1 3 4
5
1 5 3 4 2
8
8 1 5 7 4 2 3 6
7
1 2 5 3 4 7 6
7
1 7 6 3 5 4 2
3
1 3 2
4
4 1 3 2
5
...

output:

4
1 2
1 2
1 1
2 1
10
1 1
1 2
1 3
6 1
2 2
5 2
3 1
4 3
4 1
3 4
14
1 2
2 2
1 3
7 1
2 1
6 2
3 5
4 3
4 2
4 4
5 2
3 5
6 2
1 6
7
1 1
1 4
6 1
2 5
4 2
3 1
4 3
14
1 8
1 2
2 7
6 2
3 2
6 3
4 1
5 4
5 4
3 5
6 2
3 6
7 1
2 7
11
1 3
1 2
1 3
2 1
2 1
2 2
2 1
1 3
1 1
3 1
1 2
7
1 2
1 2
1 1
1 2
1 1
2 1
1 1
2
1 2
4 1
2
1 ...

result:

ok OK in maximum 0 operations

Test #15:

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

input:

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

output:

24
1 11
11 2
1 8
13 1
2 3
12 2
3 5
11 3
4 1
10 4
5 1
9 5
6 4
8 6
7 2
7 7
8 6
5 8
10 2
4 10
11 2
3 11
12 1
2 12
26
1 12
12 2
1 14
16 1
2 15
14 2
3 14
13 3
4 5
13 4
5 2
12 5
6 7
11 6
7 8
10 7
8 1
9 8
9 1
8 9
10 4
7 10
12 5
4 12
13 4
3 13
27
1 12
1 2
1 2
12 1
2 11
10 2
3 8
10 3
4 7
9 4
5 2
8 5
6 3
7 6
...

result:

ok OK in maximum 11 operations

Test #16:

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

input:

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

output:

24
1 12
12 2
1 1
15 1
2 6
14 2
3 3
13 3
4 11
12 4
5 8
11 5
6 2
10 6
7 9
8 7
10 6
5 10
11 3
5 11
12 2
4 12
13 3
2 13
29
1 1
1 2
1 11
14 1
2 11
13 2
3 9
12 3
4 7
11 4
5 7
10 5
6 8
9 6
9 3
6 9
10 3
5 10
11 4
3 11
12 1
3 12
13 1
2 13
13 1
1 14
1 1
14 1
1 13
26
1 1
1 6
13 1
2 5
12 2
3 6
11 3
4 8
10 4
5 5...

result:

ok OK in maximum 21 operations

Test #17:

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

input:

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

output:

9
1 1
1 2
1 3
2 1
2 1
1 3
1 1
3 1
1 2
10
1 4
4 2
2 3
6 2
3 5
4 3
4 2
4 4
5 3
2 5
23
1 1
1 2
1 1
9 1
2 1
8 2
3 2
7 3
4 1
6 4
5 3
5 5
6 4
3 6
7 1
3 7
8 2
1 8
8 1
1 9
1 1
9 1
1 8
28
1 1
1 2
1 11
15 1
2 6
14 2
3 4
13 3
4 2
12 4
5 4
11 5
6 6
10 6
7 5
9 7
8 6
8 8
9 4
7 9
10 1
6 10
11 2
5 11
12 2
4 12
13 3...

result:

ok OK in maximum 10 operations

Test #18:

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

input:

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

output:

12
1 2
2 2
1 1
7 1
2 3
6 2
3 2
5 3
4 4
3 4
5 1
3 5
19
1 5
5 2
1 4
8 1
2 1
7 2
3 2
6 3
4 2
5 4
5 2
4 5
6 2
3 6
7 1
1 8
1 1
8 1
1 7
12
1 8
8 2
1 5
9 1
4 1
6 4
5 4
5 5
6 4
3 6
7 1
3 7
27
1 9
9 2
1 14
16 1
3 8
14 3
5 9
12 5
6 8
11 6
7 7
10 7
9 5
8 9
11 3
6 11
12 4
5 12
14 3
2 14
15 2
1 15
15 1
1 16
1 1
...

result:

ok OK in maximum 26 operations

Test #19:

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

input:

1
1000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

0

result:

ok OK in maximum 0 operations

Test #20:

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

input:

1
1000
1000 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 ...

output:

2000
1 1
1 1
998 1
2 997
996 2
3 996
995 3
4 995
994 4
5 994
993 5
6 993
992 6
7 992
991 7
8 991
990 8
9 990
989 9
10 989
988 10
11 988
987 11
12 987
986 12
13 986
985 13
14 985
984 14
15 984
983 15
16 983
982 16
17 982
981 17
18 981
980 18
19 980
979 19
20 979
978 20
21 978
977 21
22 977
976 22
23 ...

result:

ok OK in maximum 2000 operations

Test #21:

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

input:

1
1000
2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 52 51 54 53 56 55 58 57 60 59 62 61 64 63 66 65 68 67 70 69 72 71 74 73 76 75 78 77 80 79 82 81 84 83 86 85 88 87 90 89 92 91 94 93 96 95 98 97 100 99 1...

output:

1997
1 998
1 2
3 996
995 3
4 994
995 4
5 994
993 5
6 992
993 6
7 992
991 7
8 990
991 8
9 990
989 9
10 988
989 10
11 988
987 11
12 986
987 12
13 986
985 13
14 984
985 14
15 984
983 15
16 982
983 16
17 982
981 17
18 980
981 18
19 980
979 19
20 978
979 20
21 978
977 21
22 976
977 22
23 976
975 23
24 97...

result:

ok OK in maximum 1997 operations

Test #22:

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

input:

1
1000
999 1 998 2 1000 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 9...

output:

6
1 998
1 2
1 997
998 1
2 996
997 2

result:

ok OK in maximum 6 operations

Test #23:

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

input:

1
999
998 1 997 2 999 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 ...

output:

6
1 997
1 2
1 996
997 1
2 995
996 2

result:

ok OK in maximum 6 operations

Test #24:

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

input:

1
999
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

output:

0

result:

ok OK in maximum 0 operations

Test #25:

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

input:

1
999
999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 927 92...

output:

1998
1 1
1 1
997 1
2 996
995 2
3 995
994 3
4 994
993 4
5 993
992 5
6 992
991 6
7 991
990 7
8 990
989 8
9 989
988 9
10 988
987 10
11 987
986 11
12 986
985 12
13 985
984 13
14 984
983 14
15 983
982 15
16 982
981 16
17 981
980 17
18 980
979 18
19 979
978 19
20 978
977 20
21 977
976 21
22 976
975 22
23 ...

result:

ok OK in maximum 1998 operations

Test #26:

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

input:

1
999
2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 52 51 54 53 56 55 58 57 60 59 62 61 64 63 66 65 68 67 70 69 72 71 74 73 76 75 78 77 80 79 82 81 84 83 86 85 88 87 90 89 92 91 94 93 96 95 98 97 100 99 10...

output:

1995
1 997
1 2
3 995
994 3
4 993
994 4
5 993
992 5
6 991
992 6
7 991
990 7
8 989
990 8
9 989
988 9
10 987
988 10
11 987
986 11
12 985
986 12
13 985
984 13
14 983
984 14
15 983
982 15
16 981
982 16
17 981
980 17
18 979
980 18
19 979
978 19
20 977
978 20
21 977
976 21
22 975
976 22
23 975
974 23
24 97...

result:

ok OK in maximum 1995 operations

Test #27:

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

input:

1
998
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

output:

0

result:

ok OK in maximum 0 operations

Test #28:

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

input:

1
998
998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 927 926 92...

output:

1996
1 1
1 1
996 1
2 995
994 2
3 994
993 3
4 993
992 4
5 992
991 5
6 991
990 6
7 990
989 7
8 989
988 8
9 988
987 9
10 987
986 10
11 986
985 11
12 985
984 12
13 984
983 13
14 983
982 14
15 982
981 15
16 981
980 16
17 980
979 17
18 979
978 18
19 978
977 19
20 977
976 20
21 976
975 21
22 975
974 22
23 ...

result:

ok OK in maximum 1996 operations

Test #29:

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

input:

1
998
2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 52 51 54 53 56 55 58 57 60 59 62 61 64 63 66 65 68 67 70 69 72 71 74 73 76 75 78 77 80 79 82 81 84 83 86 85 88 87 90 89 92 91 94 93 96 95 98 97 100 99 10...

output:

1993
1 996
1 2
3 994
993 3
4 992
993 4
5 992
991 5
6 990
991 6
7 990
989 7
8 988
989 8
9 988
987 9
10 986
987 10
11 986
985 11
12 984
985 12
13 984
983 13
14 982
983 14
15 982
981 15
16 980
981 16
17 980
979 17
18 978
979 18
19 978
977 19
20 976
977 20
21 976
975 21
22 974
975 22
23 974
973 23
24 97...

result:

ok OK in maximum 1993 operations

Test #30:

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

input:

1
997
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

output:

0

result:

ok OK in maximum 0 operations

Test #31:

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

input:

1
997
997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 927 926 925 92...

output:

1994
1 1
1 1
995 1
2 994
993 2
3 993
992 3
4 992
991 4
5 991
990 5
6 990
989 6
7 989
988 7
8 988
987 8
9 987
986 9
10 986
985 10
11 985
984 11
12 984
983 12
13 983
982 13
14 982
981 14
15 981
980 15
16 980
979 16
17 979
978 17
18 978
977 18
19 977
976 19
20 976
975 20
21 975
974 21
22 974
973 22
23 ...

result:

ok OK in maximum 1994 operations

Test #32:

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

input:

1
997
2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 52 51 54 53 56 55 58 57 60 59 62 61 64 63 66 65 68 67 70 69 72 71 74 73 76 75 78 77 80 79 82 81 84 83 86 85 88 87 90 89 92 91 94 93 96 95 98 97 100 99 10...

output:

1991
1 995
1 2
3 993
992 3
4 991
992 4
5 991
990 5
6 989
990 6
7 989
988 7
8 987
988 8
9 987
986 9
10 985
986 10
11 985
984 11
12 983
984 12
13 983
982 13
14 981
982 14
15 981
980 15
16 979
980 16
17 979
978 17
18 977
978 18
19 977
976 19
20 975
976 20
21 975
974 21
22 973
974 22
23 973
972 23
24 97...

result:

ok OK in maximum 1991 operations

Test #33:

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

input:

1
1000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 392 97 98 99 100 ...

output:

20
95 608
904 95
96 294
903 96
147 580
852 147
148 270
851 148
216 693
783 216
217 88
782 217
306 693
692 306
391 1
608 391
392 606
607 392
420 579
578 420

result:

ok OK in maximum 20 operations

Test #34:

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

input:

1
1000
1000 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 ...

output:

1994
1 1
1 1
998 1
2 997
996 2
3 996
995 3
4 995
994 4
5 994
993 5
6 993
992 6
7 992
991 7
8 991
990 8
9 990
989 9
10 989
988 10
11 988
987 11
12 987
986 12
13 986
985 13
14 985
984 14
15 984
983 15
16 983
982 16
17 982
981 17
18 981
980 18
19 980
979 19
20 979
978 20
21 978
977 21
22 977
976 22
23 ...

result:

ok OK in maximum 1994 operations

Test #35:

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

input:

1
1000
2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 52 51 54 53 56 55 58 57 60 59 62 61 64 63 66 65 68 67 70 69 72 71 74 73 76 75 78 77 80 79 473 81 84 83 86 85 88 87 90 89 92 91 94 93 96 95 98 97 100 99 ...

output:

1993
1 998
1 2
3 996
995 3
4 994
995 4
5 994
993 5
6 992
993 6
7 992
991 7
8 990
991 8
9 990
989 9
10 988
989 10
11 988
987 11
12 986
987 12
13 986
985 13
14 984
985 14
15 984
983 15
16 982
983 16
17 982
981 17
18 980
981 18
19 980
979 19
20 978
979 20
21 978
977 21
22 976
977 22
23 976
975 23
24 97...

result:

ok OK in maximum 1993 operations

Test #36:

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

input:

1
1000
999 1 998 2 1000 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 673 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 ...

output:

26
1 998
1 2
1 997
998 1
2 996
997 2
33 327
966 33
34 637
965 34
351 226
648 351
352 420
647 352
455 333
544 455
456 209
543 456
666 333
332 666
672 1
327 672
673 325
326 673
774 225
224 774

result:

ok OK in maximum 26 operations

Test #37:

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

input:

1
1000
999 1 998 2 1000 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 9...

output:

40
1 998
1 2
1 997
998 1
2 996
997 2
303 540
696 303
304 154
695 304
354 171
645 354
355 472
644 355
459 1
540 459
460 538
539 460
655 189
344 655
656 153
343 656
666 185
333 666
667 146
332 667
810 1
189 810
811 187
188 811
815 184
183 815
829 170
169 829
971 11
28 971
972 15
27 972
988 11
10 988

result:

ok OK in maximum 40 operations

Test #38:

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

input:

1
999
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

output:

18
462 487
536 462
463 47
535 463
511 487
486 511
642 346
356 642
643 8
355 643
652 346
345 652
720 177
278 720
721 99
277 721
821 177
176 821

result:

ok OK in maximum 18 operations

Test #39:

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

input:

1
999
999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 927 92...

output:

1992
1 1
1 1
997 1
2 996
995 2
3 995
994 3
4 994
993 4
5 993
992 5
6 992
991 6
7 991
990 7
8 990
989 8
9 989
988 9
10 988
987 10
11 987
986 11
12 986
985 12
13 985
984 13
14 984
983 14
15 983
982 15
16 982
981 16
17 981
980 17
18 980
979 18
19 979
978 19
20 978
977 20
21 977
976 21
22 976
975 22
23 ...

result:

ok OK in maximum 1992 operations

Test #40:

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

input:

1
999
2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 52 51 54 53 56 55 58 57 60 59 62 61 64 63 66 65 68 67 70 69 72 71 74 73 76 75 78 77 80 79 82 81 84 83 86 85 88 87 90 89 92 91 94 93 96 95 98 97 100 99 10...

output:

1991
1 997
1 2
3 995
994 3
4 993
994 4
5 993
992 5
6 991
992 6
7 991
990 7
8 989
990 8
9 989
988 9
10 987
988 10
11 987
986 11
12 985
986 12
13 985
984 13
14 983
984 14
15 983
982 15
16 981
982 16
17 981
980 17
18 979
980 18
19 979
978 19
20 977
978 20
21 977
976 21
22 975
976 22
23 975
974 23
24 97...

result:

ok OK in maximum 1991 operations

Test #41:

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

input:

1
998
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 426 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

20
63 572
934 63
64 360
933 64
325 403
672 325
326 267
671 326
345 416
652 345
346 234
651 346
425 2
572 425
426 569
571 426
582 415
414 582
595 402
401 595

result:

ok OK in maximum 20 operations

Test #42:

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

input:

1
998
998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 927 926 92...

output:

1994
1 1
1 1
996 1
2 995
994 2
3 994
993 3
4 993
992 4
5 992
991 5
6 991
990 6
7 990
989 7
8 989
988 8
9 988
987 9
10 987
986 10
11 986
985 11
12 985
984 12
13 984
983 13
14 983
982 14
15 982
981 15
16 981
980 16
17 980
979 17
18 979
978 18
19 978
977 19
20 977
976 20
21 976
975 21
22 975
974 22
23 ...

result:

ok OK in maximum 1994 operations

Test #43:

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

input:

1
998
2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 52 51 54 53 56 55 58 57 60 59 62 61 64 63 66 65 68 67 70 69 72 71 74 73 76 75 78 77 80 79 82 81 84 83 86 85 88 87 90 89 92 91 94 93 96 95 98 97 100 99 95...

output:

1987
1 996
1 2
3 994
993 3
4 992
993 4
5 992
991 5
6 990
991 6
7 990
989 7
8 988
989 8
9 988
987 9
10 986
987 10
11 986
985 11
12 984
985 12
13 984
983 13
14 982
983 14
15 982
981 15
16 980
981 16
17 980
979 17
18 978
979 18
19 978
977 19
20 976
977 20
21 976
975 21
22 974
975 22
23 974
973 23
24 97...

result:

ok OK in maximum 1987 operations

Test #44:

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

input:

1
997
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

output:

20
180 664
816 180
181 150
815 181
332 664
663 332
378 552
618 378
379 64
617 379
411 396
585 411
412 187
584 412
444 1
552 444
445 550
551 445
601 395
394 601

result:

ok OK in maximum 20 operations

Test #45:

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

input:

1
997
997 996 995 994 993 992 991 990 989 988 987 986 176 984 983 982 981 980 979 978 977 976 975 974 973 756 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 927 926 925 92...

output:

1990
1 1
1 1
995 1
2 994
993 2
3 993
992 3
4 992
991 4
5 991
990 5
6 990
989 6
7 989
988 7
8 988
987 8
9 987
986 9
10 986
985 10
11 985
984 11
12 984
983 12
13 983
982 13
14 982
981 14
15 981
980 15
16 980
979 16
17 979
978 17
18 978
977 18
19 977
976 19
20 976
975 20
21 975
974 21
22 974
973 22
23 ...

result:

ok OK in maximum 1990 operations

Test #46:

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

input:

1
997
2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 52 51 54 53 56 55 58 57 60 59 62 61 64 63 66 65 68 67 70 69 72 71 74 73 76 75 78 77 80 79 82 81 84 83 86 85 88 87 90 89 92 91 94 93 96 95 98 97 100 99 10...

output:

1985
1 995
1 2
3 993
992 3
4 991
992 4
5 991
990 5
6 989
990 6
7 989
988 7
8 987
988 8
9 987
986 9
10 985
986 10
11 985
984 11
12 983
984 12
13 983
982 13
14 981
982 14
15 981
980 15
16 979
980 16
17 979
978 17
18 977
978 18
19 977
976 19
20 975
976 20
21 975
974 21
22 973
974 22
23 973
972 23
24 97...

result:

ok OK in maximum 1985 operations

Test #47:

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

input:

1
786
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 188 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 316 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

44
17 598
768 17
18 168
767 18
55 471
730 55
56 257
729 56
187 1
598 187
188 596
597 188
254 17
531 254
255 512
530 255
267 358
518 267
268 158
517 268
293 120
492 293
294 370
491 294
315 3
470 315
316 466
469 316
428 1
357 428
429 355
356 429
571 58
214 571
572 154
213 572
667 1
118 667
668 116
117...

result:

ok OK in maximum 44 operations

Test #48:

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

input:

1
979
979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 81 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 900 932 931 930 929 928 927 926 925 924 923 509 921 920 919 918 917 916 915 914 913 912 911 910 909 908 907 906...

output:

1948
1 1
1 1
977 1
2 976
975 2
3 975
974 3
4 974
973 4
5 973
972 5
6 972
971 6
7 971
970 7
8 970
969 8
9 969
968 9
10 968
967 10
11 967
966 11
12 966
965 12
13 965
964 13
14 964
963 14
15 963
962 15
16 962
961 16
17 961
960 17
18 960
959 18
19 959
958 19
20 958
957 20
21 957
956 21
22 956
955 22
23 ...

result:

ok OK in maximum 1948 operations

Test #49:

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

input:

1
798
2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 52 51 54 53 56 55 58 57 60 59 62 61 64 63 66 65 68 67 70 69 72 71 74 73 76 75 78 77 349 79 82 81 84 83 86 85 88 87 90 89 92 91 94 93 96 95 98 97 100 99 1...

output:

1583
1 796
1 2
3 794
793 3
4 792
793 4
5 792
791 5
6 790
791 6
7 790
789 7
8 788
789 8
9 788
787 9
10 786
787 10
11 786
785 11
12 784
785 12
13 784
783 13
14 782
783 14
15 782
781 15
16 780
781 16
17 780
779 17
18 778
779 18
19 778
777 19
20 776
777 20
21 776
775 21
22 774
775 22
23 774
773 23
24 77...

result:

ok OK in maximum 1583 operations

Test #50:

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

input:

1
997
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

output:

48
264 239
732 264
265 491
731 265
290 168
706 290
291 536
705 291
411 53
585 411
412 530
584 412
432 370
564 432
433 192
563 433
626 370
369 626
643 99
353 643
644 252
352 644
677 86
319 677
678 231
318 678
757 4
239 757
758 234
238 758
802 158
194 802
803 34
193 803
829 4
167 829
830 162
166 830
8...

result:

ok OK in maximum 48 operations

Test #51:

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

input:

1
876
876 875 874 873 872 871 870 402 868 867 866 865 864 863 862 861 860 859 858 857 856 855 854 853 852 851 850 849 848 847 846 845 844 843 842 841 840 839 838 837 836 835 834 833 832 831 830 829 828 827 826 825 824 823 822 821 820 819 818 817 816 815 814 813 812 811 810 809 808 807 806 805 804 80...

output:

1746
1 1
1 1
874 1
2 873
872 2
3 872
871 3
4 871
870 4
5 870
869 5
6 869
868 6
7 868
867 7
8 867
866 8
9 866
865 9
10 865
864 10
11 864
863 11
12 863
862 12
13 862
861 13
14 861
860 14
15 860
859 15
16 859
858 16
17 858
857 17
18 857
856 18
19 856
855 19
20 855
854 20
21 854
853 21
22 853
852 22
23 ...

result:

ok OK in maximum 1746 operations

Test #52:

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

input:

1
991
2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 52 51 54 53 56 55 58 57 60 59 62 61 64 63 66 65 353 67 70 69 72 71 74 73 76 75 78 77 80 79 82 81 84 83 86 85 88 87 90 89 92 91 94 93 96 95 98 97 100 99 1...

output:

1975
1 989
1 2
3 987
986 3
4 985
986 4
5 985
984 5
6 983
984 6
7 983
982 7
8 981
982 8
9 981
980 9
10 979
980 10
11 979
978 11
12 977
978 12
13 977
976 13
14 975
976 14
15 975
974 15
16 973
974 16
17 973
972 17
18 971
972 18
19 971
970 19
20 969
970 20
21 969
968 21
22 967
968 22
23 967
966 23
24 96...

result:

ok OK in maximum 1975 operations

Test #53:

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

input:

1
994
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

output:

12
240 30
753 240
241 721
752 241
350 406
643 350
351 235
642 351
587 406
405 587
963 30
29 963

result:

ok OK in maximum 12 operations

Test #54:

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

input:

1
989
989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 948 947 946 945 944 943 942 941 940 939 938 937 936 935 934 933 932 931 930 929 928 927 926 925 924 923 922 921 920 919 918 917 91...

output:

1976
1 1
1 1
987 1
2 986
985 2
3 985
984 3
4 984
983 4
5 983
982 5
6 982
981 6
7 981
980 7
8 980
979 8
9 979
978 9
10 978
977 10
11 977
976 11
12 976
975 12
13 975
974 13
14 974
973 14
15 973
972 15
16 972
971 16
17 971
970 17
18 970
969 18
19 969
968 19
20 968
967 20
21 967
966 21
22 966
965 22
23 ...

result:

ok OK in maximum 1976 operations

Test #55:

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

input:

1
995
2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 52 51 54 53 56 55 58 57 60 59 62 61 64 63 66 65 68 67 70 69 72 71 74 73 76 75 78 77 80 79 82 81 84 83 86 85 88 87 90 89 92 91 94 93 96 95 98 97 100 99 10...

output:

1975
1 993
1 2
3 991
990 3
4 989
990 4
5 989
988 5
6 987
988 6
7 987
986 7
8 985
986 8
9 985
984 9
10 983
984 10
11 983
982 11
12 981
982 12
13 981
980 13
14 979
980 14
15 979
978 15
16 977
978 16
17 977
976 17
18 975
976 18
19 975
974 19
20 973
974 20
21 973
972 21
22 971
972 22
23 971
970 23
24 96...

result:

ok OK in maximum 1975 operations

Test #56:

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

input:

1
779
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...

output:

26
217 299
561 217
218 260
560 218
332 113
446 332
333 331
445 333
355 230
423 355
356 191
422 356
479 2
299 479
480 296
298 480
549 229
228 549
666 112
111 666
724 30
54 724
725 22
53 725
748 30
29 748

result:

ok OK in maximum 26 operations

Test #57:

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

input:

1
797
797 796 795 794 793 792 791 790 789 788 787 786 785 784 783 782 781 780 779 778 777 776 775 774 773 772 771 770 769 768 767 766 765 764 763 762 761 760 759 758 757 756 755 754 753 752 751 750 749 748 747 746 745 744 743 742 741 740 739 738 737 736 735 734 733 732 731 730 729 180 727 726 725 72...

output:

1590
1 1
1 1
795 1
2 794
793 2
3 793
792 3
4 792
791 4
5 791
790 5
6 790
789 6
7 789
788 7
8 788
787 8
9 787
786 9
10 786
785 10
11 785
784 11
12 784
783 12
13 783
782 13
14 782
781 14
15 781
780 15
16 780
779 16
17 779
778 17
18 778
777 18
19 777
776 19
20 776
775 20
21 775
774 21
22 774
773 22
23 ...

result:

ok OK in maximum 1590 operations

Test #58:

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

input:

1
666
2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 594 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 52 51 54 53 56 55 58 57 60 59 62 61 64 63 66 65 68 67 70 69 72 71 74 73 76 75 78 77 80 79 82 81 84 83 86 85 88 87 90 89 92 91 94 93 96 95 98 97 100 99 1...

output:

1321
1 664
1 2
3 662
661 3
4 660
661 4
5 660
659 5
6 658
659 6
7 658
657 7
8 656
657 8
9 656
655 9
10 654
655 10
11 654
653 11
12 652
653 12
13 652
651 13
14 650
651 14
15 650
649 15
16 648
649 16
17 648
647 17
18 646
647 18
19 646
645 19
20 644
645 20
21 644
643 21
22 642
643 22
23 642
641 23
24 64...

result:

ok OK in maximum 1321 operations

Test #59:

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

input:

1
1000
578 309 830 993 658 748 234 814 841 592 32 353 750 217 807 478 970 442 676 274 850 638 367 776 63 165 649 945 475 773 528 491 986 918 68 966 448 992 879 503 364 564 290 675 47 586 891 954 5 982 305 628 34 881 593 130 409 431 824 757 931 948 751 188 434 69 19 190 825 855 253 732 663 65 133 835...

output:

1989
1 511
511 2
1 244
998 1
2 948
997 2
3 947
996 3
4 803
995 4
5 569
994 5
6 958
993 6
7 618
992 7
8 355
991 8
9 30
990 9
10 324
989 10
11 734
988 11
12 435
987 12
13 821
986 13
14 363
985 14
15 13
984 15
16 91
983 16
17 819
982 17
18 767
981 18
19 331
980 19
20 395
979 20
21 218
978 21
22 607
977...

result:

ok OK in maximum 1989 operations

Test #60:

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

input:

1
999
587 632 199 969 304 657 430 733 692 680 378 704 506 884 832 959 150 898 242 641 968 818 77 584 806 529 74 29 338 205 555 410 72 82 964 487 774 111 765 625 835 580 992 437 65 602 958 517 800 637 795 128 350 626 450 694 262 812 287 289 468 603 432 561 942 827 714 101 54 996 656 874 681 932 718 2...

output:

1989
1 148
148 2
1 151
997 1
2 293
996 2
3 407
995 3
4 493
994 4
5 448
993 5
6 928
992 6
7 168
991 7
8 788
990 8
9 732
989 9
10 855
988 10
11 84
987 11
12 173
986 12
13 343
985 13
14 840
984 14
15 702
983 15
16 591
982 16
17 758
981 17
18 663
980 18
19 247
979 19
20 562
978 20
21 179
977 21
22 662
9...

result:

ok OK in maximum 1989 operations

Test #61:

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

input:

1
1000
942 663 980 943 478 437 896 721 40 616 613 423 487 344 424 269 639 813 335 35 359 2 115 701 366 940 495 545 879 42 296 826 370 859 599 861 996 530 459 724 412 622 136 548 918 171 160 343 547 14 658 807 681 636 448 928 132 893 982 227 388 757 543 814 985 585 742 301 815 897 831 298 950 925 758...

output:

1984
1 560
560 2
1 977
998 1
2 816
997 2
3 47
996 3
4 925
995 4
5 401
994 5
6 214
993 6
7 876
992 7
8 174
991 8
9 830
990 9
10 220
989 10
11 154
988 11
12 765
987 12
13 500
986 13
14 881
985 14
15 293
984 15
16 847
983 16
17 748
982 17
18 954
981 18
19 609
980 19
20 705
979 20
21 219
978 21
22 589
9...

result:

ok OK in maximum 1984 operations

Test #62:

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

input:

1
999
113 438 987 12 663 156 157 317 757 698 170 134 491 495 80 899 426 750 437 979 938 121 199 210 399 96 76 286 855 47 242 416 728 352 271 562 203 755 116 981 643 161 816 840 49 385 681 331 306 179 50 213 695 929 628 807 952 884 349 34 43 92 326 639 850 474 104 806 963 737 898 45 409 629 809 20 95...

output:

1980
1 782
782 2
1 316
997 1
2 283
996 2
3 90
995 3
4 84
994 4
5 978
993 5
6 110
992 6
7 243
991 7
8 199
990 8
9 935
989 9
10 37
988 10
11 685
987 11
12 564
986 12
13 24
985 13
14 547
984 14
15 720
983 15
16 349
982 16
17 559
981 17
18 476
980 18
19 618
979 19
20 743
978 20
21 727
977 21
22 375
976 ...

result:

ok OK in maximum 1980 operations

Test #63:

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

input:

1
1000
546 417 781 732 488 684 86 603 677 529 678 253 756 307 819 476 757 899 838 976 755 246 418 55 904 512 727 440 960 642 969 294 163 434 873 317 87 91 329 840 243 459 522 959 694 689 278 620 472 591 766 54 425 147 128 213 315 95 267 365 825 295 533 900 380 502 291 862 788 872 938 800 21 419 995 ...

output:

1984
1 537
537 2
1 548
998 1
2 657
997 2
3 317
996 3
4 168
995 4
5 12
994 5
6 88
993 6
7 501
992 7
8 872
991 8
9 144
990 9
10 342
989 10
11 61
988 11
12 282
987 12
13 532
986 13
14 27
985 14
15 570
984 15
16 478
983 16
17 699
982 17
18 440
981 18
19 941
980 19
20 148
979 20
21 871
978 21
22 630
977 ...

result:

ok OK in maximum 1984 operations

Test #64:

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

input:

1
999
774 166 908 231 496 472 465 16 102 978 49 570 597 411 168 299 378 561 429 668 676 250 362 784 840 650 326 370 377 548 134 845 183 793 809 934 928 980 619 404 331 173 256 644 382 901 426 232 200 144 780 617 743 609 431 17 520 24 425 794 334 450 786 135 280 490 245 236 215 25 380 719 155 126 471...

output:

1987
1 209
209 2
1 817
997 1
2 972
996 2
3 794
995 3
4 734
994 4
5 16
993 5
6 303
992 6
7 685
991 7
8 848
990 8
9 1
989 9
10 95
988 10
11 546
987 11
12 964
986 12
13 64
985 13
14 981
984 14
15 99
983 15
16 935
982 16
17 549
981 17
18 976
980 18
19 534
979 19
20 270
978 20
21 311
977 21
22 80
976 22
...

result:

ok OK in maximum 1987 operations

Test #65:

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

input:

1
1000
766 935 587 770 502 232 760 629 561 481 89 664 571 241 87 326 708 605 79 721 871 752 669 555 123 990 269 400 583 290 594 346 933 719 859 830 181 510 61 658 706 399 911 411 778 948 306 707 781 47 740 434 645 18 944 847 668 336 886 811 548 155 599 404 461 278 211 589 884 672 785 989 941 17 260 ...

output:

1995
1 342
342 2
1 642
998 1
2 763
997 2
3 892
996 3
4 603
995 4
5 810
994 5
6 723
993 6
7 761
992 7
8 308
991 8
9 44
990 9
10 61
989 10
11 169
988 11
12 852
987 12
13 98
986 13
14 690
985 14
15 953
984 15
16 477
983 16
17 19
982 17
18 276
981 18
19 272
980 19
20 100
979 20
21 556
978 21
22 144
977 ...

result:

ok OK in maximum 1995 operations

Test #66:

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

input:

1
999
543 320 106 886 488 688 182 305 911 670 598 134 828 201 627 69 124 132 811 768 65 423 281 189 801 599 312 567 999 487 762 764 405 778 898 365 957 743 990 951 516 28 388 477 261 296 464 619 984 227 504 329 391 507 317 612 560 1 557 649 20 376 945 744 881 926 260 322 831 271 781 950 144 262 789 ...

output:

1991
1 941
941 2
1 688
997 1
2 671
996 2
3 465
995 3
4 992
994 4
5 207
993 5
6 796
992 6
7 890
991 7
8 268
990 8
9 828
989 9
10 277
988 10
11 295
987 11
12 894
986 12
13 215
985 13
14 365
984 14
15 332
983 15
16 140
982 16
17 658
981 17
18 548
980 18
19 302
979 19
20 120
978 20
21 512
977 21
22 808
...

result:

ok OK in maximum 1991 operations

Test #67:

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

input:

1
1000
608 358 52 308 498 40 688 621 736 287 525 969 537 769 681 653 309 330 490 385 232 585 472 379 406 704 522 667 291 593 260 206 72 162 443 399 801 230 127 718 421 721 415 471 968 159 110 38 838 587 880 172 281 900 335 144 987 568 119 196 62 299 145 545 864 922 211 635 649 822 793 134 403 640 11...

output:

1995
1 170
170 2
1 682
998 1
2 207
997 2
3 200
996 3
4 187
995 4
5 377
994 5
6 38
993 6
7 916
992 7
8 205
991 8
9 198
990 9
10 432
989 10
11 889
988 11
12 406
987 12
13 135
986 13
14 908
985 14
15 617
984 15
16 135
983 16
17 525
982 17
18 955
981 18
19 500
980 19
20 600
979 20
21 875
978 21
22 671
9...

result:

ok OK in maximum 1995 operations

Test #68:

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

input:

1
999
911 432 290 796 764 61 990 509 200 218 304 386 312 204 690 672 655 883 532 365 667 675 457 840 900 842 437 536 766 925 637 287 346 232 523 721 190 770 483 481 908 740 952 954 514 213 700 51 216 16 297 586 593 55 502 240 889 746 472 858 831 423 138 689 89 739 407 972 613 201 914 490 518 340 961...

output:

1993
1 833
833 2
1 417
997 1
2 50
996 2
3 172
995 3
4 553
994 4
5 669
993 5
6 295
992 6
7 107
991 7
8 640
990 8
9 499
989 9
10 926
988 10
11 945
987 11
12 250
986 12
13 275
985 13
14 948
984 14
15 128
983 15
16 876
982 16
17 3
981 17
18 413
980 18
19 906
979 19
20 85
978 20
21 865
977 21
22 477
976 ...

result:

ok OK in maximum 1993 operations

Test #69:

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

input:

1
1000
553 48 915 421 206 713 491 894 864 951 261 512 602 976 136 283 132 380 824 617 955 681 51 514 158 601 900 945 9 534 995 268 33 473 825 54 476 26 999 981 399 223 649 263 167 948 253 679 120 13 734 949 917 609 575 838 646 359 369 312 478 485 802 246 931 680 774 632 286 201 961 723 763 585 724 7...

output:

1976
1 574
574 2
1 487
998 1
2 251
997 2
3 853
996 3
4 681
995 4
5 176
994 5
6 984
993 6
7 109
992 7
8 409
991 8
9 655
990 9
10 804
989 10
11 440
988 11
12 58
987 12
13 237
986 13
14 287
985 14
15 573
984 15
16 386
983 16
17 889
982 17
18 357
981 18
19 124
980 19
20 813
979 20
22 321
977 22
23 605
9...

result:

ok OK in maximum 1976 operations

Test #70:

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

input:

1
999
801 440 924 519 4 420 320 244 674 455 838 164 783 603 676 967 352 407 973 727 29 929 875 970 792 138 152 552 312 978 807 489 61 648 177 717 424 691 186 825 123 454 684 206 944 240 491 873 709 314 582 216 613 479 960 872 214 98 921 209 39 818 403 380 841 327 854 704 548 42 365 371 135 387 640 1...

output:

1993
1 304
304 2
1 540
997 1
2 33
996 2
3 418
995 3
4 68
994 4
5 297
993 5
6 272
992 6
7 442
991 7
8 16
990 8
9 390
989 9
10 969
988 10
11 340
987 11
12 865
986 12
13 673
985 13
14 383
984 14
15 444
983 15
16 395
982 16
17 957
981 17
18 709
980 18
19 65
979 19
20 508
978 20
21 617
977 21
22 205
976 ...

result:

ok OK in maximum 1993 operations

Test #71:

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

input:

1
1000
671 474 830 79 544 973 560 315 103 804 954 850 756 890 450 395 773 792 256 407 928 983 682 621 388 378 67 718 243 640 812 4 788 511 230 503 456 150 246 496 454 738 217 411 204 876 305 9 940 290 280 498 849 980 986 327 85 110 285 647 80 552 691 586 479 786 190 293 976 151 188 581 783 311 639 3...

output:

1974
1 178
178 2
1 145
998 1
2 608
997 2
3 212
996 3
4 797
995 4
5 235
994 5
6 177
993 6
7 660
992 7
8 102
991 8
9 537
990 9
10 103
989 10
11 774
988 11
12 837
987 12
13 576
986 13
14 554
985 14
15 425
984 15
16 84
983 16
17 827
982 17
18 88
981 18
19 819
980 19
20 146
979 20
21 443
978 21
22 903
97...

result:

ok OK in maximum 1974 operations

Test #72:

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

input:

1
999
673 776 646 216 614 126 24 515 606 840 979 826 527 349 524 512 679 735 355 972 152 105 772 844 850 784 672 857 775 136 155 761 174 71 798 977 851 628 62 153 892 23 953 97 717 786 237 315 800 869 60 142 802 446 351 299 55 861 852 251 505 900 880 936 482 101 376 236 338 952 653 661 310 503 803 2...

output:

1984
1 487
487 2
1 101
997 1
2 420
996 2
3 530
995 3
4 219
994 4
5 637
993 5
6 935
992 6
7 522
991 7
8 153
990 8
9 511
989 9
10 403
988 10
11 632
987 11
12 983
986 12
13 71
985 13
14 398
984 14
15 202
983 15
16 972
982 16
17 761
981 17
18 584
980 18
19 663
979 19
20 45
978 20
21 976
977 21
22 87
976...

result:

ok OK in maximum 1984 operations