QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#48637#4218. Hidden Graphckiseki#TL 200ms3840kbC++1.4kb2022-09-14 20:36:432022-09-14 20:36:45

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-09-14 20:36:45]
  • 评测
  • 测评结果:TL
  • 用时:200ms
  • 内存:3840kb
  • [2022-09-14 20:36:43]
  • 提交

answer

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

bool ask(unordered_set<int> &s, pair<int,int> &e) {
    if (s.size() <= 1) {
        return false;
    }

    printf("? %d", (int)s.size());
    for (int x: s)
        printf(" %d", x);
    printf("\n");
    fflush(stdout);
    scanf("%d%d", &e.first, &e.second);
    return not (e.first == -1 && e.second == -1);
}

vector<int> ask_edges(const vector<int> &v, int i) {
    unordered_set<int> st(v.begin(), v.end());
    st.insert(i);
    pair<int,int> e;
    vector<int> adj;
    while (ask(st, e)) {
        int j = e.first == i ? e.second : e.first;
        adj.push_back(j);
        st.erase(j);
    }
    return adj;
}

int main() {
    // cin.tie(nullptr)->sync_with_stdio(false);
    int n;
    scanf("%d", &n);

    vector<pair<int,int>> ans;
    vector<vector<int>> buc;
    for (int i = 1; i <= n; i++) {
        bool found = false;
        for (auto &v: buc) {
            auto E = ask_edges(v, i);
            if (not found && E.empty()) {
                v.push_back(i);
                found = true;
            }
            for (int j: E) {
                ans.emplace_back(i, j);
            }
        }
        if (not found) {
            vector<int> v{i};
            buc.emplace_back(v);
        }
    }

    printf("! %d\n", (int)ans.size());
    for (auto [a, b]: ans)
        printf("%d %d\n", a, b);

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1 2
1 3
2 3

output:

? 2 2 1
? 2 3 1
? 2 3 2
! 3
2 1
3 1
3 2

result:

ok correct

Test #2:

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

input:

10
1 2
1 3
-1 -1
1 4
-1 -1
-1 -1
2 5
4 5
-1 -1
-1 -1
2 6
-1 -1
-1 -1
3 7
-1 -1
-1 -1
4 8
3 8
-1 -1
-1 -1
3 9
-1 -1
-1 -1
4 10
3 10
-1 -1

output:

? 2 2 1
? 2 3 1
? 2 3 2
? 2 4 1
? 3 4 3 2
? 2 5 1
? 4 5 4 3 2
? 3 5 4 3
? 2 5 3
? 3 6 5 1
? 4 6 4 3 2
? 3 6 4 3
? 4 7 6 5 1
? 4 7 4 3 2
? 3 7 4 2
? 5 8 7 6 5 1
? 4 8 4 3 2
? 3 8 3 2
? 2 8 2
? 6 9 8 7 6 5 1
? 4 9 4 3 2
? 3 9 4 2
? 7 10 9 8 7 6 5 1
? 4 10 4 3 2
? 3 10 3 2
? 2 10 2
! 12
2 1
3 1
4 1
5 2...

result:

ok correct

Test #3:

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

input:

5
2 1
3 1
3 2
4 1
4 2
-1 -1
5 1
5 2
-1 -1

output:

? 2 2 1
? 2 3 1
? 2 3 2
? 2 4 1
? 2 4 2
? 2 4 3
? 2 5 1
? 2 5 2
? 3 5 4 3
! 7
2 1
3 1
3 2
4 1
4 2
5 1
5 2

result:

ok correct

Test #4:

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

input:

3
2 1
1 3
-1 -1

output:

? 2 2 1
? 2 3 1
? 2 3 2
! 2
2 1
3 1

result:

ok correct

Test #5:

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

input:

6
1 2
3 1
3 2
-1 -1
4 2
3 4
4 5
-1 -1
2 5
3 5
-1 -1
-1 -1
3 6
-1 -1

output:

? 2 2 1
? 2 3 1
? 2 3 2
? 2 4 1
? 2 4 2
? 2 4 3
? 3 5 4 1
? 2 5 1
? 2 5 2
? 2 5 3
? 3 6 4 1
? 2 6 2
? 2 6 3
? 2 6 5
! 9
2 1
3 1
3 2
4 2
4 3
5 4
5 2
5 3
6 3

result:

ok correct

Test #6:

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

input:

27
-1 -1
3 1
3 2
-1 -1
-1 -1
1 5
2 5
-1 -1
3 5
6 1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 8
-1 -1
6 8
-1 -1
-1 -1
1 9
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
10 8
-1 -1
1 11
4 11
-1 -1
6 11
-1 -1
5 11
-1 -1
-1 -1
-1 -1
5 12
-1 -1
12 11
10 13
-1 -1
6 13
-1 -1
8 13
5 13
-1 -1
14 12
14 1
-1 -1
6 14
-1 -1
14 5
14 ...

output:

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

result:

ok correct

Test #7:

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

input:

47
-1 -1
-1 -1
-1 -1
5 4
5 3
-1 -1
-1 -1
-1 -1
7 6
-1 -1
7 5
-1 -1
5 8
-1 -1
9 4
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
10 7
11 1
-1 -1
-1 -1
7 11
12 3
2 12
-1 -1
11 12
5 12
-1 -1
7 12
-1 -1
13 11
13 5
-1 -1
13 7
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
4 15
13 15
-1 -1
-1 -1
-1 -1
-1 -1
16 1
-1 -1
-1 -1
-1 -1
-1 -1
17...

output:

? 2 2 1
? 3 3 2 1
? 4 4 3 2 1
? 5 5 4 3 2 1
? 4 5 3 2 1
? 3 5 2 1
? 5 6 4 3 2 1
? 2 6 5
? 6 7 6 4 3 2 1
? 5 7 4 3 2 1
? 2 7 5
? 6 8 6 4 3 2 1
? 2 8 5
? 2 8 7
? 7 9 8 6 4 3 2 1
? 6 9 8 6 3 2 1
? 2 9 5
? 2 9 7
? 7 10 8 6 4 3 2 1
? 3 10 9 5
? 2 10 7
? 8 11 10 8 6 4 3 2 1
? 7 11 10 8 6 4 3 2
? 3 11 9 5
...

result:

ok correct

Test #8:

score: 0
Accepted
time: 7ms
memory: 3808kb

input:

38
-1 -1
-1 -1
4 1
-1 -1
1 5
3 5
-1 -1
4 5
-1 -1
4 6
-1 -1
2 7
6 7
-1 -1
4 7
7 5
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
4 10
-1 -1
-1 -1
11 1
-1 -1
11 4
-1 -1
-1 -1
12 8
-1 -1
-1 -1
11 12
-1 -1
12 7
13 8
13 1
-1 -1
4 13
13 12
11 13
-1 -1
-1 -1
3 14
6 14
1 14
-1 -1
-1 -1
14 5
11 14
-1 ...

output:

? 2 2 1
? 3 3 2 1
? 4 4 3 2 1
? 3 4 3 2
? 4 5 3 2 1
? 3 5 3 2
? 2 5 2
? 2 5 4
? 4 6 3 2 1
? 2 6 4
? 2 6 5
? 5 7 6 3 2 1
? 4 7 6 3 1
? 3 7 3 1
? 2 7 4
? 2 7 5
? 5 8 6 3 2 1
? 2 8 4
? 2 8 5
? 2 8 7
? 6 9 8 6 3 2 1
? 2 9 4
? 2 9 5
? 2 9 7
? 7 10 9 8 6 3 2 1
? 2 10 4
? 2 10 5
? 2 10 7
? 8 11 10 9 8 6 3 ...

result:

ok correct

Test #9:

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

input:

25
-1 -1
-1 -1
-1 -1
5 4
5 2
-1 -1
6 4
-1 -1
-1 -1
7 3
-1 -1
5 7
-1 -1
4 8
2 8
-1 -1
5 8
-1 -1
-1 -1
9 4
2 9
-1 -1
-1 -1
9 8
-1 -1
10 3
-1 -1
-1 -1
-1 -1
2 11
-1 -1
10 11
9 11
-1 -1
-1 -1
12 4
-1 -1
6 12
-1 -1
-1 -1
-1 -1
5 13
6 13
-1 -1
13 8
7 13
-1 -1
14 3
14 13
14 4
-1 -1
5 14
-1 -1
7 14
-1 -1
-1...

output:

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

result:

ok correct

Test #10:

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

input:

6
-1 -1
2 3
-1 -1
-1 -1
-1 -1
2 5
-1 -1
-1 -1
-1 -1
5 6
-1 -1

output:

? 2 2 1
? 3 3 2 1
? 2 3 1
? 3 4 2 1
? 2 4 3
? 4 5 4 2 1
? 3 5 4 1
? 2 5 3
? 4 6 4 2 1
? 3 6 5 3
? 2 6 3
! 3
3 2
5 2
6 5

result:

ok correct

Test #11:

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

input:

3
2 1
3 1
2 3

output:

? 2 2 1
? 2 3 1
? 2 3 2
! 3
2 1
3 1
3 2

result:

ok correct

Test #12:

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

input:

3
2 1
3 1
-1 -1

output:

? 2 2 1
? 2 3 1
? 2 3 2
! 2
2 1
3 1

result:

ok correct

Test #13:

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

input:

5
2 1
3 1
2 3
-1 -1
-1 -1
-1 -1
5 1
-1 -1
2 5
-1 -1

output:

? 2 2 1
? 2 3 1
? 2 3 2
? 2 4 1
? 2 4 2
? 2 4 3
? 3 5 4 1
? 2 5 4
? 2 5 2
? 2 5 3
! 5
2 1
3 1
3 2
5 1
5 2

result:

ok correct

Test #14:

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

input:

3
2 1
-1 -1
-1 -1

output:

? 2 2 1
? 2 3 1
? 2 3 2
! 1
2 1

result:

ok correct

Test #15:

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

input:

5
-1 -1
-1 -1
4 3
-1 -1
2 5
3 5
-1 -1
-1 -1

output:

? 2 2 1
? 3 3 2 1
? 4 4 3 2 1
? 3 4 2 1
? 4 5 3 2 1
? 3 5 3 1
? 2 5 1
? 2 5 4
! 3
4 3
5 2
5 3

result:

ok correct

Test #16:

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

input:

93
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
10 9
-1 -1
7 11
-1 -1
-1 -1
2 12
-1 -1
-1 -1
5 13
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
15 12
-1 -1
6 16
8 16
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
19 18
-1 -1
11 19
-1 -1
-1 -1
20 16
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
8 23
1 23
-1 -1
-1 -1
-1 -1...

output:

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

result:

ok correct

Test #17:

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

input:

111
-1 -1
-1 -1
-1 -1
-1 -1
2 6
-1 -1
7 4
-1 -1
-1 -1
3 8
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
2 11
4 11
-1 -1
-1 -1
12 4
-1 -1
6 12
7 12
12 11
-1 -1
13 10
-1 -1
7 13
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
17 10
-1 -1
-1 -1
-1 -1
4 18
18 5
-1 -1
-1 -1
-1 -1
16 19
-1 -1
11 1...

output:

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

result:

ok correct

Test #18:

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

input:

132
-1 -1
3 1
-1 -1
-1 -1
-1 -1
5 1
-1 -1
-1 -1
-1 -1
6 3
-1 -1
7 2
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
10 8
-1 -1
5 10
-1 -1
-1 -1
-1 -1
-1 -1
12 8
-1 -1
-1 -1
-1 -1
9 13
-1 -1
-1 -1
-1 -1
2 14
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
17 15
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
19 6
-1 -...

output:

? 2 2 1
? 3 3 2 1
? 2 3 2
? 3 4 2 1
? 2 4 3
? 4 5 4 2 1
? 3 5 4 2
? 2 5 3
? 4 6 4 2 1
? 3 6 5 3
? 2 6 5
? 5 7 6 4 2 1
? 4 7 6 4 1
? 3 7 5 3
? 5 8 6 4 2 1
? 4 8 7 5 3
? 6 9 8 6 4 2 1
? 4 9 7 5 3
? 7 10 9 8 6 4 2 1
? 6 10 9 6 4 2 1
? 4 10 7 5 3
? 3 10 7 3
? 7 11 9 8 6 4 2 1
? 4 11 7 5 3
? 2 11 10
? 8 ...

result:

ok correct

Test #19:

score: 0
Accepted
time: 19ms
memory: 3664kb

input:

94
-1 -1
3 2
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
2 7
-1 -1
-1 -1
-1 -1
-1 -1
2 9
-1 -1
7 9
-1 -1
-1 -1
-1 -1
-1 -1
11 6
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
6 13
-1 -1
11 13
-1 -1
-1 -1
14 10
-1 -1
14 11
-1 -1
-1 -1
-1 -1
15 11
-1 -1
-1 -1
15 16
-1 -1
16 7
-1 -1
-1 -1
17 8
17 10
-1 -1
17 11
-1 ...

output:

? 2 2 1
? 3 3 2 1
? 2 3 1
? 3 4 2 1
? 2 4 3
? 4 5 4 2 1
? 2 5 3
? 5 6 5 4 2 1
? 2 6 3
? 6 7 6 5 4 2 1
? 5 7 6 5 4 1
? 2 7 3
? 6 8 6 5 4 2 1
? 3 8 7 3
? 7 9 8 6 5 4 2 1
? 6 9 8 6 5 4 1
? 3 9 7 3
? 2 9 3
? 7 10 8 6 5 4 2 1
? 3 10 7 3
? 2 10 9
? 8 11 10 8 6 5 4 2 1
? 7 11 10 8 5 4 2 1
? 3 11 7 3
? 2 11...

result:

ok correct

Test #20:

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

input:

73
-1 -1
1 3
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
5 7
6 7
-1 -1
-1 -1
-1 -1
3 8
-1 -1
1 9
9 8
-1 -1
-1 -1
4 10
1 10
-1 -1
3 10
9 10
-1 -1
4 11
-1 -1
-1 -1
-1 -1
-1 -1
12 9
12 3
-1 -1
12 10
13 6
-1 -1
13 11
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
15 8
-1 -1
-1 -1
-1 -1
1 16
16 14
-1 -1
3 16
-1 -1
10 16
-1...

output:

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

result:

ok correct

Test #21:

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

input:

77
-1 -1
3 2
-1 -1
2 4
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
3 6
-1 -1
-1 -1
3 7
-1 -1
-1 -1
3 8
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 11
-1 -1
-1 -1
-1 -1
-1 -1
8 13
-1 -1
-1 -1
2 14
14 8
14 7
-1 -1
-1 -1
2 15
15 8
-1 -1
3 15
-1 -1
16 1
16 8
2 16
-1 -1
-1 -1
16 15
7 17
2 17
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1...

output:

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

result:

ok correct

Test #22:

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

input:

81
-1 -1
2 3
-1 -1
2 4
-1 -1
-1 -1
1 5
-1 -1
4 5
-1 -1
-1 -1
4 6
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 8
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
2 10
10 6
-1 -1
10 3
10 4
-1 -1
-1 -1
-1 -1
11 3
4 11
-1 -1
-1 -1
6 12
2 12
-1 -1
8 12
-1 -1
-1 -1
-1 -1
-1 -1
10 13
-1 -1
1 14
-1 -1
-1 -1
10 14
-1 -1
13 15
-1 -1
-...

output:

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

result:

ok correct

Test #23:

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

input:

93
-1 -1
-1 -1
4 1
2 4
-1 -1
-1 -1
-1 -1
-1 -1
4 6
2 7
-1 -1
-1 -1
1 8
3 8
-1 -1
-1 -1
9 1
-1 -1
9 8
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
13 7
-1 -1
-1 -1
1 14
-1 -1
4 14
-1 -1
9 14
-1 -1
-1 -1
-1 -1
14 15
13 16
-1 -1
-1 -1
-1 -1
-1 -1
17 3
2 17
17 1
17 5
-1 -1
17 8
17 1...

output:

? 2 2 1
? 3 3 2 1
? 4 4 3 2 1
? 3 4 3 2
? 2 4 3
? 4 5 3 2 1
? 2 5 4
? 5 6 5 3 2 1
? 2 6 4
? 6 7 6 5 3 2 1
? 5 7 6 5 3 1
? 2 7 4
? 6 8 6 5 3 2 1
? 5 8 6 5 3 2
? 4 8 6 5 2
? 3 8 7 4
? 6 9 6 5 3 2 1
? 5 9 6 5 3 2
? 4 9 8 7 4
? 3 9 7 4
? 6 10 6 5 3 2 1
? 4 10 8 7 4
? 2 10 9
? 7 11 10 6 5 3 2 1
? 4 11 8 ...

result:

ok correct

Test #24:

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

input:

37
-1 -1
3 1
-1 -1
-1 -1
-1 -1
2 5
-1 -1
-1 -1
-1 -1
-1 -1
2 7
7 1
-1 -1
-1 -1
6 8
2 8
1 8
4 8
7 8
-1 -1
2 9
9 1
6 9
-1 -1
-1 -1
9 8
1 10
-1 -1
3 10
-1 -1
10 8
2 11
4 11
11 1
-1 -1
3 11
9 11
7 11
-1 -1
11 8
-1 -1
12 1
-1 -1
12 7
-1 -1
12 8
-1 -1
6 13
-1 -1
-1 -1
-1 -1
12 13
-1 -1
6 14
-1 -1
14 3
14 ...

output:

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

result:

ok correct

Test #25:

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

input:

144
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
9 15
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
14 18
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
5 22
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -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:

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

result:

ok correct

Test #26:

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

input:

561
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
26 22
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -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:

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

result:

ok correct

Test #27:

score: 0
Accepted
time: 103ms
memory: 3816kb

input:

679
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
39 40
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1...

output:

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

result:

ok correct

Test #28:

score: 0
Accepted
time: 150ms
memory: 3820kb

input:

1000
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
17 27
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-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:

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

result:

ok correct

Test #29:

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

input:

1000
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
13 14
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
6 22
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -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:

? 2 2 1
? 3 3 2 1
? 4 4 3 2 1
? 5 5 4 3 2 1
? 6 6 5 4 3 2 1
? 7 7 6 5 4 3 2 1
? 8 8 7 6 5 4 3 2 1
? 9 9 8 7 6 5 4 3 2 1
? 10 10 9 8 7 6 5 4 3 2 1
? 11 11 10 9 8 7 6 5 4 3 2 1
? 12 12 11 10 9 8 7 6 5 4 3 2 1
? 13 13 12 11 10 9 8 7 6 5 4 3 2 1
? 14 14 1 2 3 4 5 6 7 8 9 10 11 12 13
? 13 14 1 2 3 4 5 6 ...

result:

ok correct

Test #30:

score: -100
Time Limit Exceeded

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
44 15
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-...

output:

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

result: