QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#496884#4218. Hidden GraphhazeWA 9ms5900kbC++205.2kb2024-07-28 16:44:032024-07-28 16:44:03

Judging History

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

  • [2024-07-28 16:44:03]
  • 评测
  • 测评结果:WA
  • 用时:9ms
  • 内存:5900kb
  • [2024-07-28 16:44:03]
  • 提交

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

input:

3
1 2
2 3
1 3

output:

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

result:

ok correct

Test #2:

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

input:

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

output:

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

result:

ok correct

Test #3:

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

input:

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

output:

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

result:

ok correct

Test #4:

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

input:

3
1 3
2 1
-1 -1

output:

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

result:

ok correct

Test #5:

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

input:

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

output:

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

result:

ok correct

Test #6:

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

input:

27
10 15
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
3 15
-1 -1
-1 -1
3 5
5 26
-1 -1
-1 -1
-1 -1
-1 -1
3 1
1 9
-1 -1
1 5
-1 -1
4 11
-1 -1
5 11
-1 -1
1 11
9 20
-1 -1
5 20
-1 -1
-1 -1
-1 -1
10 8
-1 -1
-1 -1
1 8
-1 -1
-1 -1
3 2
2 26
-1 -1
2 5
-1 -1
-1 -1
-1 -1
-1 -1
14 5
14 8
-1 -1
14 1
-1 -1
-1 -1
10 13
26 13
-1 -1...

output:

? 2 10 15
? 2 10 25
? 2 15 25
? 3 10 25 9
? 2 15 9
? 4 10 25 9 3
? 2 15 3
? 5 10 25 9 3 26
? 2 15 26
? 6 10 25 9 3 26 5
? 5 10 25 9 26 5
? 4 10 25 9 5
? 2 15 5
? 6 10 25 9 3 26 4
? 3 15 5 4
? 7 10 25 9 3 26 4 1
? 6 10 25 9 26 4 1
? 5 10 25 26 4 1
? 3 15 5 1
? 2 15 1
? 7 10 25 9 3 26 4 11
? 6 10 25 9...

result:

ok correct

Test #7:

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

input:

47
-1 -1
-1 -1
-1 -1
43 45
-1 -1
-1 -1
27 43
-1 -1
-1 -1
-1 -1
43 39
23 35
23 24
23 10
-1 -1
23 43
-1 -1
-1 -1
-1 -1
22 10
22 39
-1 -1
22 43
-1 -1
45 47
-1 -1
-1 -1
23 47
-1 -1
21 45
10 21
27 21
21 35
-1 -1
43 21
-1 -1
22 21
-1 -1
5 39
5 35
46 5
27 5
-1 -1
43 5
-1 -1
22 5
23 5
21 5
-1 -1
43 2
-1 -1
...

output:

? 2 46 45
? 3 46 45 24
? 4 46 45 24 10
? 5 46 45 24 10 43
? 4 46 24 10 43
? 5 46 45 24 10 27
? 2 43 27
? 6 46 45 24 10 27 35
? 2 43 35
? 7 46 45 24 10 27 35 39
? 2 43 39
? 8 46 45 24 10 27 35 39 23
? 7 46 45 24 10 27 39 23
? 6 46 45 10 27 39 23
? 5 46 45 27 39 23
? 2 43 23
? 8 46 45 24 10 27 35 39 1...

result:

ok correct

Test #8:

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

input:

38
-1 -1
-1 -1
-1 -1
16 17
-1 -1
-1 -1
-1 -1
16 31
-1 -1
31 17
16 34
37 34
-1 -1
-1 -1
-1 -1
28 7
28 22
-1 -1
-1 -1
-1 -1
4 7
37 4
-1 -1
4 17
-1 -1
4 31
-1 -1
30 17
30 34
-1 -1
-1 -1
-1 -1
36 35
-1 -1
35 34
-1 -1
-1 -1
-1 -1
-1 -1
28 9
-1 -1
31 9
-1 -1
-1 -1
-1 -1
14 34
-1 -1
-1 -1
-1 -1
33 22
33 9
...

output:

? 2 37 22
? 3 37 22 16
? 4 37 22 16 36
? 5 37 22 16 36 17
? 4 37 22 36 17
? 5 37 22 16 36 7
? 2 17 7
? 6 37 22 16 36 7 31
? 5 37 22 36 7 31
? 2 17 31
? 6 37 22 16 36 7 34
? 5 37 22 36 7 34
? 4 22 36 7 34
? 2 17 34
? 2 31 34
? 6 37 22 16 36 7 28
? 5 37 22 16 36 28
? 4 37 16 36 28
? 3 17 34 28
? 2 31 ...

result:

ok correct

Test #9:

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

input:

25
8 23
-1 -1
-1 -1
8 21
-1 -1
-1 -1
2 8
-1 -1
-1 -1
-1 -1
21 11
2 11
-1 -1
19 11
-1 -1
-1 -1
-1 -1
-1 -1
9 8
9 11
-1 -1
2 9
-1 -1
-1 -1
20 23
-1 -1
20 9
20 6
-1 -1
6 21
-1 -1
-1 -1
14 13
20 13
13 8
-1 -1
13 21
13 19
-1 -1
6 13
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
20 22
14 22
-1 -1
22 21
2 22
-1 -1
6 22
-1...

output:

? 2 8 23
? 2 8 14
? 2 23 14
? 3 8 14 21
? 2 14 21
? 2 23 21
? 3 8 14 2
? 2 14 2
? 3 23 21 2
? 3 8 14 11
? 4 23 21 2 11
? 3 23 2 11
? 2 23 11
? 4 8 14 11 19
? 3 8 14 19
? 4 23 21 2 19
? 4 8 14 11 1
? 5 23 21 2 19 1
? 4 8 14 11 9
? 3 14 11 9
? 2 14 9
? 6 23 21 2 19 1 9
? 5 23 21 19 1 9
? 4 8 14 11 20
...

result:

ok correct

Test #10:

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

input:

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

output:

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

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: 0ms
memory: 3680kb

input:

3
3 1
-1 -1
2 1

output:

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

result:

ok correct

Test #13:

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

input:

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

output:

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

result:

ok correct

Test #14:

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

input:

3
-1 -1
2 1
-1 -1

output:

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

result:

ok correct

Test #15:

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

input:

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

output:

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

result:

ok correct

Test #16:

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

input:

93
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
5 47
-1 -1
-1 -1
-1 -1
-1 -1
47 76
-1 -1
-1 -1
-1 -1
-1 -1
5 43
43 14
-1 -1
-1 -1
5 56
56 23
-1 -1
56 43
-1 -1
-1 -1
43 31
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
63 11
-1 -1
-1 -1
-1 -1
21 60
21 76
-1 -1
63 21
-1 -1
-1 -1
-1 -1
35 63
47 35
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
...

output:

? 2 53 82
? 3 53 82 67
? 4 53 82 67 20
? 5 53 82 67 20 14
? 6 53 82 67 20 14 5
? 7 53 82 67 20 14 5 60
? 8 53 82 67 20 14 5 60 47
? 7 53 82 67 20 14 60 47
? 8 53 82 67 20 14 5 60 57
? 2 47 57
? 9 53 82 67 20 14 5 60 57 76
? 2 47 76
? 10 53 82 67 20 14 5 60 57 76 23
? 2 47 23
? 11 53 82 67 20 14 5 60...

result:

ok correct

Test #17:

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

input:

111
110 71
-1 -1
-1 -1
57 71
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
71 74
-1 -1
-1 -1
-1 -1
-1 -1
65 71
-1 -1
65 110
65 57
-1 -1
17 34
-1 -1
-1 -1
-1 -1
29 34
-1 -1
-1 -1
-1 -1
97 28
97 71
-1 -1
97 17
-1 -1
-1 -1
71 11
-1 -1
110 11
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
65 13
-1 -1
25 31
-1 -1
110 2...

output:

? 2 71 110
? 2 71 34
? 2 110 34
? 3 71 34 57
? 2 34 57
? 2 110 57
? 3 71 34 28
? 3 110 57 28
? 4 71 34 28 31
? 3 110 57 31
? 5 71 34 28 31 74
? 4 34 28 31 74
? 3 110 57 74
? 5 71 34 28 31 59
? 4 110 57 74 59
? 6 71 34 28 31 59 65
? 5 34 28 31 59 65
? 4 110 57 74 65
? 3 57 74 65
? 2 74 65
? 6 71 34 2...

result:

ok correct

Test #18:

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

input:

132
-1 -1
-1 -1
-1 -1
29 80
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
130 48
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
130 99
-1 -1
33 31
-1 -1
-1 -1
99 107
-1 -1
-1 -1
9 13
-1 -1
-1 -1
-1 -1
-1 -1
82 48
101 82
-1 -1
29 82
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
83 15
83 48
-1 -1...

output:

? 2 98 33
? 3 98 33 16
? 4 98 33 16 80
? 5 98 33 16 80 29
? 4 98 33 16 29
? 5 98 33 16 80 2
? 2 29 2
? 6 98 33 16 80 2 13
? 2 29 13
? 7 98 33 16 80 2 13 48
? 2 29 48
? 8 98 33 16 80 2 13 48 130
? 7 98 33 16 80 2 13 130
? 2 29 130
? 8 98 33 16 80 2 13 48 34
? 3 29 130 34
? 9 98 33 16 80 2 13 48 34 12...

result:

ok correct

Test #19:

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

input:

94
-1 -1
86 34
78 34
-1 -1
-1 -1
-1 -1
5 34
53 86
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
53 28
34 28
5 22
-1 -1
-1 -1
39 28
39 5
39 78
-1 -1
39 22
39 53
39 34
86 93
-1 -1
-1 -1
39 93
81 78
-1 -1
-1 -1
-1 -1
86 92
-1 -1
-1 -1
39 92
15 78
-1 -1
15 53
15 34
-1 -1
39 15
40 28
-1 -1
53 40
-1 -1
-1 -1
...

output:

? 2 78 86
? 3 78 86 34
? 2 78 34
? 3 78 86 60
? 2 34 60
? 4 78 86 60 5
? 2 34 5
? 5 78 86 60 5 53
? 4 78 60 5 53
? 2 34 53
? 5 78 86 60 5 36
? 3 34 53 36
? 6 78 86 60 5 36 17
? 3 34 53 17
? 7 78 86 60 5 36 17 28
? 3 34 53 28
? 2 34 28
? 8 78 86 60 5 36 17 28 22
? 7 78 86 60 36 17 28 22
? 3 34 53 22
...

result:

ok correct

Test #20:

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

input:

73
-1 -1
12 3
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
38 41
-1 -1
-1 -1
-1 -1
3 16
-1 -1
50 38
-1 -1
3 50
-1 -1
62 11
-1 -1
-1 -1
-1 -1
70 54
16 70
-1 -1
70 41
-1 -1
-1 -1
12 36
-1 -1
-1 -1
-1 -1
1 16
-1 -1
1 3
-1 -1
-1 -1
-1 -1
62 7
-1 -1
-1 -1
12 55
55 16
-1 -1
55 3
-1 -1
1 55
-1 -1
12 35
-1 -1
-1 -1
-1 -1
...

output:

? 2 38 12
? 3 38 12 3
? 2 38 3
? 3 38 12 11
? 2 3 11
? 4 38 12 11 54
? 2 3 54
? 5 38 12 11 54 41
? 4 12 11 54 41
? 2 3 41
? 5 38 12 11 54 16
? 3 3 41 16
? 2 41 16
? 6 38 12 11 54 16 50
? 5 12 11 54 16 50
? 3 3 41 50
? 2 41 50
? 6 38 12 11 54 16 62
? 5 38 12 54 16 62
? 3 3 41 62
? 2 50 62
? 6 38 12 1...

result:

ok correct

Test #21:

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

input:

77
-1 -1
-1 -1
-1 -1
-1 -1
23 11
56 23
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
8 13
8 56
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
27 17
-1 -1
-1 -1
-1 -1
2 17
-1 -1
2 16
-1 -1
16 8
-1 -1
62 11
-1 -1
8 62
-1 -1
-1 -1
60 56
60 33
-1 -1
-1 -1
16 60
-1 -1
64 11
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 ...

output:

? 2 56 33
? 3 56 33 25
? 4 56 33 25 11
? 5 56 33 25 11 27
? 6 56 33 25 11 27 23
? 5 56 33 25 27 23
? 4 33 25 27 23
? 6 56 33 25 11 27 13
? 2 23 13
? 7 56 33 25 11 27 13 38
? 2 23 38
? 8 56 33 25 11 27 13 38 8
? 7 56 33 25 11 27 38 8
? 6 33 25 11 27 38 8
? 2 23 8
? 8 56 33 25 11 27 13 38 48
? 3 23 8 ...

result:

ok correct

Test #22:

score: 0
Accepted
time: 9ms
memory: 5600kb

input:

81
-1 -1
37 16
-1 -1
73 16
-1 -1
73 37
-1 -1
-1 -1
-1 -1
33 16
-1 -1
-1 -1
73 33
2 54
-1 -1
2 37
-1 -1
-1 -1
25 16
-1 -1
-1 -1
-1 -1
11 16
-1 -1
37 11
-1 -1
-1 -1
-1 -1
25 53
-1 -1
-1 -1
18 53
-1 -1
18 25
-1 -1
-1 -1
-1 -1
-1 -1
2 28
-1 -1
-1 -1
37 45
25 45
-1 -1
18 45
-1 -1
50 53
50 54
50 28
-1 -1
...

output:

? 2 29 16
? 3 29 16 37
? 2 29 37
? 3 29 16 73
? 2 29 73
? 2 37 73
? 3 29 16 54
? 2 37 54
? 2 73 54
? 4 29 16 54 33
? 3 29 54 33
? 2 37 33
? 2 73 33
? 4 29 16 54 2
? 3 29 16 2
? 3 37 33 2
? 2 33 2
? 2 73 2
? 4 29 16 54 25
? 3 29 54 25
? 3 37 33 25
? 3 73 2 25
? 4 29 16 54 11
? 3 29 54 11
? 4 37 33 25...

result:

ok correct

Test #23:

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

input:

93
-1 -1
38 82
-1 -1
-1 -1
-1 -1
-1 -1
82 29
-1 -1
-1 -1
-1 -1
-1 -1
29 39
-1 -1
-1 -1
38 92
-1 -1
-1 -1
2 38
-1 -1
2 82
-1 -1
-1 -1
65 39
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
8 77
85 8
-1 -1
82 8
-1 -1
-1 -1
-1 -1
-1 -1
79 8
2 79
93 48
-1 -1
-1 -1
-1 -1
85 23
-1 -1
-1 -1
23 8
-1 -1
57 29
57 38
57 85
57 79...

output:

? 2 38 87
? 3 38 87 82
? 2 87 82
? 3 38 87 77
? 2 82 77
? 4 38 87 77 29
? 2 82 29
? 5 38 87 77 29 85
? 2 82 85
? 6 38 87 77 29 85 93
? 2 82 93
? 7 38 87 77 29 85 93 39
? 6 38 87 77 85 93 39
? 2 82 39
? 7 38 87 77 29 85 93 92
? 6 87 77 29 85 93 92
? 3 82 39 92
? 7 38 87 77 29 85 93 2
? 6 87 77 29 85 ...

result:

ok correct

Test #24:

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

input:

37
7 1
-1 -1
-1 -1
22 23
-1 -1
-1 -1
-1 -1
1 31
-1 -1
-1 -1
-1 -1
7 11
33 11
11 23
-1 -1
11 1
-1 -1
32 31
32 23
33 32
7 32
32 1
-1 -1
32 11
33 24
-1 -1
24 1
22 24
24 11
24 32
33 16
31 16
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
7 29
33 29
-1 -1
29 1
22 29
29 16
-1 -1
-1 -1
24 29
33 17
7 17
-1 -1
1 17
-1 -1
11 ...

output:

? 2 7 1
? 2 7 23
? 2 1 23
? 3 7 23 22
? 2 7 22
? 2 1 22
? 3 7 23 31
? 3 1 22 31
? 2 22 31
? 4 7 23 31 33
? 3 1 22 33
? 5 7 23 31 33 11
? 4 23 31 33 11
? 3 23 31 11
? 2 31 11
? 3 1 22 11
? 2 22 11
? 5 7 23 31 33 32
? 4 7 23 33 32
? 3 7 33 32
? 2 7 32
? 3 1 22 32
? 2 22 32
? 2 11 32
? 5 7 23 31 33 24
...

result:

ok correct

Test #25:

score: -100
Wrong Answer
time: 0ms
memory: 5612kb

input:

144
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
134 99
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-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 62
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-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 88 18
? 3 88 18 99
? 4 88 18 99 104
? 5 88 18 99 104 37
? 6 88 18 99 104 37 125
? 7 88 18 99 104 37 125 95
? 8 88 18 99 104 37 125 95 134
? 7 88 18 104 37 125 95 134
? 8 88 18 99 104 37 125 95 123
? 2 134 123
? 9 88 18 99 104 37 125 95 123 7
? 2 134 7
? 10 88 18 99 104 37 125 95 123 7 17
? 2 134...

result:

wrong answer Query Limit Exceeded (lim = 432)