QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#496885#4218. Hidden GraphhazeTL 51ms5912kbC++205.2kb2024-07-28 16:44:122024-07-28 16:44:12

Judging History

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

  • [2024-07-28 16:44:12]
  • 评测
  • 测评结果:TL
  • 用时:51ms
  • 内存:5912kb
  • [2024-07-28 16:44:12]
  • 提交

answer

/*

Author: Haze

2024/7/28

*/

#include <bits/stdc++.h>

#define irep(i, l, r) for(int i = (l); i <= (r); ++ i)
#define drep(i, r, l) for(int i = (r); i >= (l); -- i)
#define IOS ios::sync_with_stdio(false), cin.tie(nullptr);
using namespace std;
typedef long long ll;

inline ll readL() {
    ll s = 0;
    bool fl = false;
    char ch = (char) getchar();
    while (!isdigit(ch)) {
        if (ch == '-')fl = true;
        ch = (char) getchar();
    }
    while (isdigit(ch)) {
        s = s * 10 + (ch ^ 48);
        ch = (char) getchar();
    }
    return fl ? -s : s;
}

inline int read() {
    return (int) (readL());
}

const int mod = 1000000000 + 7;
const int itinf = 1000000999;
const ll llinf = 2e18;
const int N = 500099;
int F[N], G[N];
std::mt19937 rng(std::chrono::system_clock::now().time_since_epoch().count());

array<int, 2> query(vector<int>&node){
    if(node.size() == 1){
        return {-1, -1};
    }
    cout << "? " << node.size();
    for(int x : node){
        cout << " " << F[x];
    }
    cout << endl;
    array<int, 2>ar{};
    cin >> ar[0] >> ar[1];
    if(ar[0] != -1)ar[0] = G[ar[0]], ar[1] = G[ar[1]];
    return ar;
}

void solve() {
    int n;
    cin >> n;
    irep(i, 1, n)F[i] = i, G[i] = i;
    shuffle(F + 1, F + n + 1, rng);
    irep(i, 1, n){
        G[F[i]] = i;
    }
    vector<vector<int>>col = {{1}};
    vector<array<int, 2>>edge;
    irep(u, 2, n){
        int to = -1;
        irep(c, 0, col.size() - 1){
            auto vec = col[c];
            vec.push_back(u);
            auto [i, j] = query(vec);
            if(i == -1){
                if(to == -1 or col[to].size() < col[c].size()){
                    to = c;
                }
            }

            while(i != -1){
                edge.push_back({i, j});

                vec.erase(lower_bound(vec.begin(), vec.end(), i + j - u));
                auto T = query(vec);
                i = T[0], j = T[1];
            }
        }
        if(to == -1){
            col.push_back({u});
        }
        else col[to].push_back(u);
    }
    cout << "! " << edge.size() << endl;
    for(auto [u, v] : edge){
        cout << F[u] << ' ' << F[v] << endl;
    }
}

int main() {
    // IOS
    int T = 1;
    while (T--) {
        solve();
    }
    return 0;
}
///*
//
//Author: Haze
//
//2024/7/28
//
//*/
//
//#include <bits/stdc++.h>
//
//#define irep(i, l, r) for(int i = (l); i <= (r); ++ i)
//#define drep(i, r, l) for(int i = (r); i >= (l); -- i)
//#define IOS ios::sync_with_stdio(false), cin.tie(nullptr);
//using namespace std;
//typedef long long ll;
//
//inline ll readL() {
//    ll s = 0;
//    bool fl = false;
//    char ch = (char) getchar();
//    while (!isdigit(ch)) {
//        if (ch == '-')fl = true;
//        ch = (char) getchar();
//    }
//    while (isdigit(ch)) {
//        s = s * 10 + (ch ^ 48);
//        ch = (char) getchar();
//    }
//    return fl ? -s : s;
//}
//
//inline int read() {
//    return (int) (readL());
//}
//
//const int mod = 1000000000 + 7;
//const int itinf = 1000000999;
//const ll llinf = 2e18;
//const int N = 500099;
//
//int G[2000][2000];
//int n, sum;
//array<int, 2> query(vector<int>&node) {
//    if (node.size() == 1) {
//        return {-1, -1};
//    }
//    ++ sum;
//    cout << "? " << node.size();
//    for(int x : node){
//        cout << " " << x;
//    }
//    cout << endl;
//    for(int u : node){
//        for(int v : node){
//            if(G[u][v]){
//                return {v, u};
//            }
//        }
//    }
//    return {-1, -1};
//}
//array<int, 2> query0(vector<int>&node){
//    if(node.size() == 1){
//        return {-1, -1};
//    }
//    cout << "? " << node.size();
//    for(int x : node){
//        cout << " " << x;
//    }
//    cout << endl;
//    array<int, 2>ar{};
//    cin >> ar[0] >> ar[1];
//    return ar;
//}
//
//void init(){
//    vector<int>a(n);
//    irep(i, 1, n)a[i - 1] = i;
//    srand(192);
//    random_shuffle(a.begin(), a.end());
//    irep(i, 1, n - 1){
//        G[a[i]][a[i - 1]] = 1;
//        G[a[i - 1]][a[i]] = 1;
//    }
////    G[n][1] = G[1][n] = 1;
//}
//
//void solve() {
//
//    vector<vector<int>>col = {{1}};
//    vector<array<int, 2>>edge;
//    irep(u, 2, n){
//        int to = -1;
//        cerr << col.size() << endl;
//        irep(c, 0, col.size() - 1){
//            auto vec = col[c];
//            vec.push_back(u);
//            auto [i, j] = query(vec);
//            if(i == -1)to = c;
//
//            while(i != -1){
//                edge.push_back({i, j});
//
//                vec.erase(find(vec.begin(), vec.end(), i + j - u));
//                auto T = query(vec);
//                i = T[0], j = T[1];
//            }
//        }
//        if(to == -1){
//            col.push_back({u});
//        }
//        else col[to].push_back(u);
//    }
//    cout << "! " << edge.size() << endl;
//    for(auto [u, v] : edge){
//        cout << u << ' ' << v << endl;
//    }
//}
//
//int main() {
//    // IOS
//    int T = 1;
//    cin >> n;
//    init();
//    while (T--) {
//        solve();
//    }
//    cerr << sum;
//    return 0;
//}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 5660kb

input:

3
1 3
1 2
2 3

output:

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

result:

ok correct

Test #2:

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

input:

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

output:

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

result:

ok correct

Test #3:

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

input:

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

output:

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

result:

ok correct

Test #4:

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

input:

3
2 1
-1 -1
1 3

output:

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

result:

ok correct

Test #5:

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

input:

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

output:

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

result:

ok correct

Test #6:

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

input:

27
-1 -1
-1 -1
-1 -1
4 11
-1 -1
21 2
-1 -1
-1 -1
6 16
-1 -1
6 11
-1 -1
-1 -1
12 11
-1 -1
-1 -1
23 27
2 27
-1 -1
27 11
21 27
-1 -1
-1 -1
21 24
-1 -1
24 27
6 24
24 13
-1 -1
-1 -1
6 13
-1 -1
24 5
2 5
5 12
-1 -1
21 5
5 11
5 13
5 27
-1 -1
2 19
19 16
24 19
-1 -1
21 19
19 13
19 11
19 27
6 19
5 19
-1 -1
-1 ...

output:

? 2 2 4
? 3 2 4 16
? 4 2 4 16 23
? 5 2 4 16 23 11
? 4 2 16 23 11
? 5 2 4 16 23 21
? 4 4 16 23 21
? 2 11 21
? 5 2 4 16 23 6
? 4 2 4 23 6
? 3 11 21 6
? 2 21 6
? 5 2 4 16 23 12
? 3 11 21 12
? 2 21 12
? 2 6 12
? 6 2 4 16 23 12 27
? 5 2 4 16 12 27
? 4 4 16 12 27
? 3 11 21 27
? 2 21 27
? 2 6 27
? 6 2 4 16...

result:

ok correct

Test #7:

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

input:

47
-1 -1
-1 -1
21 42
-1 -1
44 15
4 15
21 15
-1 -1
-1 -1
-1 -1
18 47
44 47
-1 -1
-1 -1
18 30
-1 -1
-1 -1
18 12
-1 -1
-1 -1
-1 -1
26 15
26 47
-1 -1
-1 -1
-1 -1
21 29
-1 -1
29 15
-1 -1
21 5
5 44
5 4
-1 -1
5 12
-1 -1
-1 -1
21 45
45 26
-1 -1
42 45
45 47
-1 -1
45 29
-1 -1
20 21
20 26
-1 -1
20 12
20 15
-1 ...

output:

? 2 21 4
? 3 21 4 44
? 4 21 4 44 42
? 3 4 44 42
? 4 21 4 44 15
? 3 21 4 15
? 2 21 15
? 2 42 15
? 4 21 4 44 18
? 3 42 15 18
? 5 21 4 44 18 47
? 4 21 4 44 47
? 3 21 4 47
? 3 42 15 47
? 5 21 4 44 18 30
? 4 21 4 44 30
? 4 42 15 47 30
? 5 21 4 44 18 12
? 4 21 4 44 12
? 5 42 15 47 30 12
? 5 21 4 44 18 26
...

result:

ok correct

Test #8:

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

input:

38
-1 -1
-1 -1
6 14
14 34
-1 -1
-1 -1
14 5
12 34
-1 -1
-1 -1
3 5
3 34
-1 -1
3 14
-1 -1
6 7
7 5
-1 -1
12 7
-1 -1
-1 -1
-1 -1
12 32
-1 -1
-1 -1
24 6
-1 -1
24 12
-1 -1
-1 -1
36 5
-1 -1
-1 -1
-1 -1
33 6
-1 -1
-1 -1
24 33
-1 -1
35 34
35 32
-1 -1
12 35
-1 -1
36 35
-1 -1
-1 -1
-1 -1
-1 -1
35 25
-1 -1
-1 -1...

output:

? 2 26 6
? 3 26 6 34
? 4 26 6 34 14
? 3 26 34 14
? 2 26 14
? 4 26 6 34 5
? 2 14 5
? 5 26 6 34 5 12
? 4 26 6 5 12
? 2 14 12
? 5 26 6 34 5 3
? 4 26 6 34 3
? 3 26 6 3
? 3 14 12 3
? 2 12 3
? 5 26 6 34 5 7
? 4 26 34 5 7
? 3 26 34 7
? 3 14 12 7
? 2 14 7
? 2 3 7
? 5 26 6 34 5 32
? 3 14 12 32
? 2 14 32
? 3 ...

result:

ok correct

Test #9:

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

input:

25
-1 -1
-1 -1
13 21
14 13
-1 -1
8 21
-1 -1
13 8
-1 -1
13 19
-1 -1
14 4
-1 -1
-1 -1
4 8
7 19
7 14
-1 -1
7 13
-1 -1
-1 -1
-1 -1
4 17
-1 -1
7 17
-1 -1
-1 -1
-1 -1
-1 -1
24 15
-1 -1
-1 -1
-1 -1
-1 -1
9 4
-1 -1
9 8
-1 -1
9 11
19 11
21 11
-1 -1
-1 -1
-1 -1
10 15
10 21
10 17
-1 -1
10 11
-1 -1
-1 -1
18 21
...

output:

? 2 21 1
? 3 21 1 14
? 4 21 1 14 13
? 3 1 14 13
? 2 1 13
? 4 21 1 14 8
? 3 1 14 8
? 2 13 8
? 4 21 1 14 19
? 2 13 19
? 2 8 19
? 5 21 1 14 19 4
? 4 21 1 19 4
? 2 13 4
? 2 8 4
? 5 21 1 14 19 7
? 4 21 1 14 7
? 3 21 1 7
? 3 13 4 7
? 2 4 7
? 2 8 7
? 5 21 1 14 19 17
? 3 13 4 17
? 2 13 17
? 3 8 7 17
? 2 8 1...

result:

ok correct

Test #10:

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

input:

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

output:

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

result:

ok correct

Test #11:

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

input:

3
2 3
2 1
3 1

output:

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

result:

ok correct

Test #12:

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

input:

3
2 1
-1 -1
3 1

output:

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

result:

ok correct

Test #13:

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

input:

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

output:

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

result:

ok correct

Test #14:

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

input:

3
-1 -1
2 1
-1 -1

output:

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

result:

ok correct

Test #15:

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

input:

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

output:

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

result:

ok correct

Test #16:

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

input:

93
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
47 76
-1 -1
27 52
-1 -1
-1 -1
-1 -1
-1 -1
70 69
-1 -1
-1 -1
-1 -1
80 76
-1 -1
-1 -1
-1 -1
5 52
5 90
5 29
5 47
-1 -1
-1 -1
47 65
-1 -1
-1 -1
36 90
-1 -1
-1 -1
3 90
3 29
-1 -1
-1 -1
80 38
70 38
-1 -1
27 38
-1 -1
-1 -1
-1 -1
-1 -1
80 77
77 57
77 29
-1 -1
27 77
5 77
-1 -...

output:

? 2 60 57
? 3 60 57 90
? 4 60 57 90 47
? 5 60 57 90 47 29
? 6 60 57 90 47 29 52
? 7 60 57 90 47 29 52 76
? 6 60 57 90 29 52 76
? 7 60 57 90 47 29 52 27
? 6 60 57 90 47 29 27
? 2 76 27
? 7 60 57 90 47 29 52 70
? 3 76 27 70
? 8 60 57 90 47 29 52 70 69
? 7 60 57 90 47 29 52 69
? 3 76 27 69
? 8 60 57 90...

result:

ok correct

Test #17:

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

input:

111
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
66 100
42 66
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
39 1
102 1
-1 -1
-1 -1
37 25
-1 -1
-1 -1
61 81
61 64
-1 -1
61 1
-1 -1
37 93
93 45
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
97 71
42 71
71 63
37 71
71 72
-1 -1
-1 -1
-1 -1
45 74
42 ...

output:

? 2 63 97
? 3 63 97 72
? 4 63 97 72 39
? 5 63 97 72 39 55
? 6 63 97 72 39 55 42
? 7 63 97 72 39 55 42 19
? 8 63 97 72 39 55 42 19 59
? 9 63 97 72 39 55 42 19 59 45
? 10 63 97 72 39 55 42 19 59 45 100
? 11 63 97 72 39 55 42 19 59 45 100 102
? 12 63 97 72 39 55 42 19 59 45 100 102 37
? 13 63 97 72 39 ...

result:

ok correct

Test #18:

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

input:

132
-1 -1
-1 -1
19 39
19 43
-1 -1
-1 -1
-1 -1
-1 -1
19 72
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
51 11
-1 -1
-1 -1
131 43
-1 -1
-1 -1
31 105
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
53 31
19 53
53 131
-1 -1
-1 -1
131 41
-1 -1
21 48
72 48
-1 -1
19 48
-1 -1
53 119
-1 -1
-1 -1
-1 -1
3 62
62 1...

output:

? 2 43 39
? 3 43 39 105
? 4 43 39 105 19
? 3 43 105 19
? 2 105 19
? 4 43 39 105 80
? 2 19 80
? 5 43 39 105 80 72
? 2 19 72
? 6 43 39 105 80 72 21
? 2 19 21
? 7 43 39 105 80 72 21 75
? 2 19 75
? 8 43 39 105 80 72 21 75 102
? 2 19 102
? 9 43 39 105 80 72 21 75 102 11
? 2 19 11
? 10 43 39 105 80 72 21 ...

result:

ok correct

Test #19:

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

input:

94
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
11 59
-1 -1
43 25
-1 -1
-1 -1
76 59
-1 -1
-1 -1
-1 -1
-1 -1
2 37
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 74
23 74
-1 -1
11 74
-1 -1
35 63
-1 -1
-1 -1
-1 -1
43 40
-1 -1
76 40
11 40
37 40
-1 -1
-1 -1
59 71
-1 -1
71 37
11 71
-1 -1
-1 -1
3 35
3 2
-1 -1
-1...

output:

? 2 59 23
? 3 59 23 43
? 4 59 23 43 69
? 5 59 23 43 69 35
? 6 59 23 43 69 35 2
? 7 59 23 43 69 35 2 8
? 8 59 23 43 69 35 2 8 11
? 7 23 43 69 35 2 8 11
? 8 59 23 43 69 35 2 8 25
? 7 59 23 69 35 2 8 25
? 2 11 25
? 8 59 23 43 69 35 2 8 76
? 7 23 43 69 35 2 8 76
? 3 11 25 76
? 8 59 23 43 69 35 2 8 62
? ...

result:

ok correct

Test #20:

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

input:

73
-1 -1
-1 -1
-1 -1
-1 -1
52 11
13 11
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
4 40
-1 -1
4 11
48 13
12 48
48 30
63 48
-1 -1
-1 -1
-1 -1
32 65
-1 -1
11 32
-1 -1
-1 -1
-1 -1
57 11
-1 -1
-1 -1
52 60
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
28 63
28 40
-1 -1
28 60
-1 -1
-1 -1
52 42
42 57...

output:

? 2 13 52
? 3 13 52 8
? 4 13 52 8 63
? 5 13 52 8 63 65
? 6 13 52 8 63 65 11
? 5 13 8 63 65 11
? 4 8 63 65 11
? 6 13 52 8 63 65 40
? 2 11 40
? 7 13 52 8 63 65 40 12
? 2 11 12
? 8 13 52 8 63 65 40 12 30
? 2 11 30
? 9 13 52 8 63 65 40 12 30 4
? 8 13 52 8 63 65 12 30 4
? 2 11 4
? 9 13 52 8 63 65 40 12 3...

result:

ok correct

Test #21:

score: 0
Accepted
time: 6ms
memory: 5912kb

input:

77
-1 -1
-1 -1
-1 -1
58 42
-1 -1
-1 -1
-1 -1
58 27
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
40 72
-1 -1
-1 -1
26 36
-1 -1
-1 -1
70 48
-1 -1
-1 -1
12 67
-1 -1
-1 -1
75 48
-1 -1
-1 -1
-1 -1
46 72
-1 -1
-1 -1
-1 -1
-1 -1
4 27
4 36
-1 -1
50 4
50 44
-1 -1
50 42
75 50
-1 -1
58 35
35 4
35 44
-1 -1
3...

output:

? 2 44 58
? 3 44 58 6
? 4 44 58 6 40
? 5 44 58 6 40 42
? 4 44 6 40 42
? 5 44 58 6 40 48
? 2 42 48
? 6 44 58 6 40 48 27
? 5 44 6 40 48 27
? 2 42 27
? 6 44 58 6 40 48 26
? 3 42 27 26
? 7 44 58 6 40 48 26 12
? 3 42 27 12
? 8 44 58 6 40 48 26 12 59
? 3 42 27 59
? 9 44 58 6 40 48 26 12 59 72
? 8 44 58 6 ...

result:

ok correct

Test #22:

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

input:

81
-1 -1
-1 -1
-1 -1
-1 -1
71 45
58 71
-1 -1
-1 -1
-1 -1
44 53
58 44
-1 -1
71 44
33 16
13 16
-1 -1
-1 -1
-1 -1
35 53
35 13
58 35
-1 -1
71 35
35 16
35 44
33 81
-1 -1
-1 -1
-1 -1
-1 -1
10 13
10 45
58 10
-1 -1
-1 -1
10 44
10 35
42 33
58 42
42 45
-1 -1
42 16
10 42
-1 -1
42 44
42 35
65 53
-1 -1
65 10
65 ...

output:

? 2 45 17
? 3 45 17 13
? 4 45 17 13 53
? 5 45 17 13 53 58
? 6 45 17 13 53 58 71
? 5 17 13 53 58 71
? 4 17 13 53 71
? 6 45 17 13 53 58 33
? 2 71 33
? 7 45 17 13 53 58 33 44
? 6 45 17 13 58 33 44
? 5 45 17 13 33 44
? 2 71 44
? 7 45 17 13 53 58 33 16
? 6 45 17 13 53 58 16
? 5 45 17 53 58 16
? 2 71 16
?...

result:

ok correct

Test #23:

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

input:

93
93 1
-1 -1
42 1
-1 -1
-1 -1
-1 -1
-1 -1
93 90
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
93 48
-1 -1
-1 -1
-1 -1
43 1
43 90
-1 -1
24 29
-1 -1
-1 -1
-1 -1
9 1
-1 -1
42 6
-1 -1
-1 -1
-1 -1
-1 -1
69 15
42 15
-1 -1
24 15
-1 -1
9 28
-1 -1
24 28
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
13 49
-1 -1
-1 -1
-1 -...

output:

? 2 93 1
? 2 93 42
? 2 1 42
? 3 93 42 78
? 2 1 78
? 4 93 42 78 69
? 2 1 69
? 5 93 42 78 69 90
? 4 42 78 69 90
? 2 1 90
? 5 93 42 78 69 29
? 3 1 90 29
? 6 93 42 78 69 29 52
? 3 1 90 52
? 7 93 42 78 69 29 52 65
? 3 1 90 65
? 8 93 42 78 69 29 52 65 48
? 7 42 78 69 29 52 65 48
? 3 1 90 48
? 8 93 42 78 6...

result:

ok correct

Test #24:

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

input:

37
-1 -1
25 18
28 18
7 28
-1 -1
7 18
35 28
35 25
-1 -1
-1 -1
23 28
25 23
35 23
23 18
-1 -1
25 26
28 26
18 26
35 26
7 26
-1 -1
25 32
-1 -1
-1 -1
7 32
32 23
-1 -1
3 28
3 25
3 32
3 18
-1 -1
3 23
-1 -1
3 26
28 34
25 34
35 34
32 34
18 34
23 34
7 34
26 34
-1 -1
-1 -1
35 17
17 18
-1 -1
7 17
-1 -1
17 26
17 ...

output:

? 2 28 25
? 3 28 25 18
? 2 28 18
? 3 28 25 7
? 2 25 7
? 2 18 7
? 3 28 25 35
? 2 25 35
? 2 18 35
? 2 7 35
? 3 28 25 23
? 2 25 23
? 3 18 35 23
? 2 18 23
? 2 7 23
? 3 28 25 26
? 2 28 26
? 3 18 35 26
? 2 35 26
? 3 7 23 26
? 2 23 26
? 3 28 25 32
? 2 28 32
? 3 18 35 32
? 3 7 23 32
? 2 23 32
? 2 26 32
? 3 ...

result:

ok correct

Test #25:

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

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
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
135 126
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
126 16
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
86 78
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1...

output:

? 2 66 1
? 3 66 1 56
? 4 66 1 56 112
? 5 66 1 56 112 101
? 6 66 1 56 112 101 95
? 7 66 1 56 112 101 95 14
? 8 66 1 56 112 101 95 14 78
? 9 66 1 56 112 101 95 14 78 99
? 10 66 1 56 112 101 95 14 78 99 68
? 11 66 1 56 112 101 95 14 78 99 68 20
? 12 66 1 56 112 101 95 14 78 99 68 20 142
? 13 66 1 56 11...

result:

ok correct

Test #26:

score: 0
Accepted
time: 13ms
memory: 5660kb

input:

561
-1 -1
77 146
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
151 77
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-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 146 81
? 3 146 81 77
? 2 81 77
? 3 146 81 511
? 2 77 511
? 4 146 81 511 159
? 2 77 159
? 5 146 81 511 159 535
? 2 77 535
? 6 146 81 511 159 535 71
? 2 77 71
? 7 146 81 511 159 535 71 549
? 2 77 549
? 8 146 81 511 159 535 71 549 342
? 2 77 342
? 9 146 81 511 159 535 71 549 342 344
? 2 77 344
? 10...

result:

ok correct

Test #27:

score: 0
Accepted
time: 21ms
memory: 5892kb

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
23 330
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-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 21 209
? 3 21 209 515
? 4 21 209 515 414
? 5 21 209 515 414 610
? 6 21 209 515 414 610 23
? 7 21 209 515 414 610 23 111
? 8 21 209 515 414 610 23 111 418
? 9 21 209 515 414 610 23 111 418 76
? 10 21 209 515 414 610 23 111 418 76 673
? 11 21 209 515 414 610 23 111 418 76 673 142
? 12 21 209 515 4...

result:

ok correct

Test #28:

score: 0
Accepted
time: 40ms
memory: 5768kb

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
789 153
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
773 211
-1 -1
-1 -1
-1 -1
-1 -1
-1 ...

output:

? 2 661 741
? 3 661 741 533
? 4 661 741 533 96
? 5 661 741 533 96 512
? 6 661 741 533 96 512 773
? 7 661 741 533 96 512 773 152
? 8 661 741 533 96 512 773 152 258
? 9 661 741 533 96 512 773 152 258 363
? 10 661 741 533 96 512 773 152 258 363 989
? 11 661 741 533 96 512 773 152 258 363 989 875
? 12 6...

result:

ok correct

Test #29:

score: 0
Accepted
time: 51ms
memory: 5736kb

input:

1000
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
128 899
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
489 773
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 ...

output:

? 2 128 237
? 3 128 237 115
? 4 128 237 115 633
? 5 128 237 115 633 476
? 6 128 237 115 633 476 539
? 7 128 237 115 633 476 539 625
? 8 128 237 115 633 476 539 625 899
? 7 237 115 633 476 539 625 899
? 8 128 237 115 633 476 539 625 615
? 2 899 615
? 9 128 237 115 633 476 539 625 615 875
? 2 899 875
...

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

output:

? 2 1867 934
? 3 1867 934 1519
? 4 1867 934 1519 1112
? 5 1867 934 1519 1112 946
? 6 1867 934 1519 1112 946 818
? 7 1867 934 1519 1112 946 818 1779
? 8 1867 934 1519 1112 946 818 1779 1511
? 9 1867 934 1519 1112 946 818 1779 1511 93
? 10 1867 934 1519 1112 946 818 1779 1511 93 1645
? 11 1867 934 151...

result: