QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#496874#4218. Hidden GraphhazeWA 60ms5832kbC++205.2kb2024-07-28 16:40:132024-07-28 16:40:14

Judging History

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

  • [2024-07-28 16:40:14]
  • 评测
  • 测评结果:WA
  • 用时:60ms
  • 内存:5832kb
  • [2024-07-28 16:40:13]
  • 提交

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(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 << 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;
//}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

input:

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

output:

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

result:

ok correct

Test #3:

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

input:

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

output:

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

result:

ok correct

Test #4:

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

input:

3
-1 -1
1 3
2 1

output:

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

result:

ok correct

Test #5:

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

input:

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

output:

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

result:

ok correct

Test #6:

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

input:

27
-1 -1
21 2
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
10 15
-1 -1
21 18
20 18
-1 -1
-1 -1
24 10
14 24
21 24
-1 -1
24 18
-1 -1
21 27
-1 -1
23 27
2 27
-1 -1
24 27
10 16
-1 -1
16 18
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
21 5
14 5
5 20
-1 -1
2 5
-1 -1
24 5
-1 -1
5 27
-1 -1
-1 -1
-1 -1
-1 -1
...

output:

? 2 21 14
? 3 21 14 2
? 2 14 2
? 3 21 14 15
? 2 2 15
? 3 21 14 20
? 3 2 15 20
? 4 21 14 20 23
? 3 2 15 23
? 4 21 14 20 10
? 4 2 15 23 10
? 3 2 23 10
? 5 21 14 20 10 18
? 4 14 20 10 18
? 3 14 10 18
? 4 2 15 23 18
? 5 21 14 20 10 24
? 4 21 14 20 24
? 3 21 20 24
? 2 20 24
? 5 2 15 23 18 24
? 4 2 15 23 ...

result:

ok correct

Test #7:

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

input:

47
-1 -1
-1 -1
21 5
17 21
-1 -1
-1 -1
21 42
43 5
17 43
-1 -1
43 21
5 28
-1 -1
21 28
-1 -1
-1 -1
21 25
43 25
-1 -1
-1 -1
21 38
-1 -1
5 44
-1 -1
-1 -1
-1 -1
42 1
25 1
17 1
-1 -1
44 1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
17 23
23 5
-1 -1
-1 -1
23 43
23 28
-1 -1
27 5
-1 -1
27 21
27 26
-1 -1
27 28
27 43
-1 -1
4...

output:

? 2 6 5
? 3 6 5 17
? 4 6 5 17 21
? 3 6 17 21
? 2 6 21
? 4 6 5 17 42
? 2 21 42
? 5 6 5 17 42 43
? 4 6 17 42 43
? 3 6 42 43
? 2 21 43
? 5 6 5 17 42 28
? 4 6 17 42 28
? 2 21 28
? 2 43 28
? 5 6 5 17 42 25
? 2 21 25
? 3 43 28 25
? 2 28 25
? 6 6 5 17 42 25 38
? 2 21 38
? 3 43 28 38
? 6 6 5 17 42 25 44
? 5...

result:

ok correct

Test #8:

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

input:

38
-1 -1
-1 -1
-1 -1
16 20
-1 -1
29 17
-1 -1
16 17
-1 -1
-1 -1
2 17
31 9
31 29
-1 -1
16 31
-1 -1
31 17
-1 -1
16 23
-1 -1
23 17
-1 -1
-1 -1
16 34
2 34
-1 -1
-1 -1
28 9
-1 -1
-1 -1
-1 -1
28 23
-1 -1
-1 -1
2 7
28 7
-1 -1
-1 -1
-1 -1
8 21
-1 -1
28 8
-1 -1
-1 -1
-1 -1
-1 -1
16 19
-1 -1
-1 -1
31 19
19 23
...

output:

? 2 20 29
? 3 20 29 21
? 4 20 29 21 9
? 5 20 29 21 9 16
? 4 29 21 9 16
? 5 20 29 21 9 17
? 4 20 21 9 17
? 2 16 17
? 5 20 29 21 9 2
? 2 16 2
? 2 17 2
? 5 20 29 21 9 31
? 4 20 29 21 31
? 3 20 21 31
? 3 16 2 31
? 2 2 31
? 2 17 31
? 5 20 29 21 9 23
? 3 16 2 23
? 2 2 23
? 2 17 23
? 2 31 23
? 5 20 29 21 9...

result:

ok correct

Test #9:

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

input:

25
-1 -1
-1 -1
21 11
-1 -1
-1 -1
2 11
16 21
-1 -1
-1 -1
-1 -1
-1 -1
4 22
2 22
22 21
-1 -1
-1 -1
4 8
8 21
2 8
-1 -1
8 23
16 8
-1 -1
24 15
-1 -1
-1 -1
-1 -1
13 21
-1 -1
16 13
13 22
-1 -1
13 8
-1 -1
18 21
18 4
18 2
-1 -1
18 22
-1 -1
18 8
-1 -1
18 13
5 2
5 21
5 4
-1 -1
-1 -1
5 8
-1 -1
5 13
-1 -1
12 4
-1...

output:

? 2 21 24
? 3 21 24 4
? 4 21 24 4 11
? 3 24 4 11
? 4 21 24 4 2
? 2 11 2
? 5 21 24 4 2 16
? 4 24 4 2 16
? 2 11 16
? 5 21 24 4 2 23
? 3 11 16 23
? 5 21 24 4 2 22
? 4 21 24 2 22
? 3 21 24 22
? 2 24 22
? 4 11 16 23 22
? 5 21 24 4 2 8
? 4 21 24 2 8
? 3 24 2 8
? 2 24 8
? 5 11 16 23 22 8
? 4 11 16 22 8
? 3...

result:

ok correct

Test #10:

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

input:

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

output:

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

result:

ok correct

Test #11:

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

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

input:

3
3 1
2 1
-1 -1

output:

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

result:

ok correct

Test #13:

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

input:

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

output:

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

result:

ok correct

Test #14:

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

input:

3
-1 -1
2 1
-1 -1

output:

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

result:

ok correct

Test #15:

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

input:

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

output:

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

result:

ok correct

Test #16:

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

input:

93
-1 -1
-1 -1
44 4
-1 -1
-1 -1
44 32
-1 -1
-1 -1
-1 -1
40 44
-1 -1
-1 -1
-1 -1
70 71
-1 -1
-1 -1
-1 -1
37 66
-1 -1
32 61
-1 -1
70 61
-1 -1
35 71
35 29
40 35
-1 -1
35 37
35 80
-1 -1
-1 -1
40 87
71 87
-1 -1
70 87
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
44 75
-1 -1
75 61
-1 -1
40 41
-1 -...

output:

? 2 4 29
? 3 4 29 71
? 4 4 29 71 44
? 3 29 71 44
? 4 4 29 71 32
? 2 44 32
? 5 4 29 71 32 80
? 2 44 80
? 5 4 29 71 32 40
? 3 44 80 40
? 2 80 40
? 6 4 29 71 32 40 37
? 3 44 80 37
? 6 4 29 71 32 40 70
? 5 4 29 32 40 70
? 4 44 80 37 70
? 6 4 29 71 32 40 66
? 5 44 80 37 70 66
? 4 44 80 70 66
? 7 4 29 71 ...

result:

ok correct

Test #17:

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

input:

111
-1 -1
-1 -1
-1 -1
-1 -1
12 82
12 101
-1 -1
-1 -1
-1 -1
107 69
-1 -1
-1 -1
69 34
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
34 52
-1 -1
101 39
-1 -1
39 89
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
65 12
-1 -1
-1 -1
-1 -1
93 78
-1 -1
-1 -1
-1 -1
-1 -1
39 62
-1 -1
-1 -1
107 56
-1 -1
65 56
56 78
-1 -1
-1 -1
-1 -...

output:

? 2 73 69
? 3 73 69 101
? 4 73 69 101 82
? 5 73 69 101 82 28
? 6 73 69 101 82 28 12
? 5 73 69 101 28 12
? 4 73 69 28 12
? 6 73 69 101 82 28 89
? 2 12 89
? 6 73 69 101 82 28 107
? 5 73 101 82 28 107
? 3 12 89 107
? 6 73 69 101 82 28 34
? 5 73 101 82 28 34
? 4 12 89 107 34
? 6 73 69 101 82 28 93
? 5 1...

result:

ok correct

Test #18:

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

input:

132
-1 -1
-1 -1
-1 -1
19 101
-1 -1
-1 -1
-1 -1
47 65
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
19 6
6 109
-1 -1
6 101
6 31
-1 -1
-1 -1
-1 -1
-1 -1
19 10
-1 -1
47 10
-1 -1
-1 -1
-1 -1
101 75
-1 -1
56 75
-1 -1
-1 -1
-1 -1
6 129
-1 -1
-1 -1
33 31
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1...

output:

? 2 59 65
? 3 59 65 108
? 4 59 65 108 19
? 5 59 65 108 19 101
? 4 59 65 108 101
? 5 59 65 108 19 123
? 2 101 123
? 5 59 65 108 19 47
? 4 59 108 19 47
? 3 101 123 47
? 5 59 65 108 19 31
? 4 101 123 47 31
? 5 59 65 108 19 109
? 5 101 123 47 31 109
? 6 59 65 108 19 109 122
? 5 101 123 47 31 122
? 6 59 ...

result:

ok correct

Test #19:

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

input:

94
-1 -1
-1 -1
54 1
1 84
-1 -1
51 92
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
92 29
-1 -1
-1 -1
92 45
-1 -1
18 45
-1 -1
58 92
-1 -1
58 1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
20 29
-1 -1
-1 -1
65 54
-1 -1
51 65
-1 -1
-1 -1
-1 -1
-1 -1
65 15
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
20 77
-1 -1
...

output:

? 2 54 92
? 3 54 92 84
? 4 54 92 84 1
? 3 92 84 1
? 2 92 1
? 4 54 92 84 51
? 3 54 84 51
? 2 1 51
? 4 54 92 84 18
? 3 1 51 18
? 4 54 92 84 48
? 4 1 51 18 48
? 5 54 92 84 48 29
? 4 54 84 48 29
? 4 1 51 18 29
? 5 54 92 84 48 45
? 4 54 84 48 45
? 5 1 51 18 29 45
? 4 1 51 29 45
? 5 54 92 84 48 58
? 4 54 ...

result:

ok correct

Test #20:

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

input:

73
-1 -1
-1 -1
-1 -1
-1 -1
46 43
-1 -1
3 10
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
14 65
-1 -1
-1 -1
1 3
-1 -1
1 10
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 58
-1 -1
-1 -1
51 39
39 43
39 10
-1 -1
-1 -1
58 35
-1 -1
51 35
35 21
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
14 45
-1 -1
-1 -1
47 45
-1 -1
-1 -1
51...

output:

? 2 37 14
? 3 37 14 46
? 4 37 14 46 3
? 5 37 14 46 3 24
? 6 37 14 46 3 24 43
? 5 37 14 3 24 43
? 6 37 14 46 3 24 10
? 5 37 14 46 24 10
? 2 43 10
? 6 37 14 46 3 24 21
? 3 43 10 21
? 6 37 14 46 3 24 51
? 4 43 10 21 51
? 6 37 14 46 3 24 15
? 5 43 10 21 51 15
? 6 37 14 46 3 24 65
? 5 37 46 3 24 65
? 6 4...

result:

ok correct

Test #21:

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

input:

77
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
40 72
-1 -1
11 54
-1 -1
-1 -1
-1 -1
-1 -1
77 72
-1 -1
77 11
-1 -1
-1 -1
64 11
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
65 67
-1 -1
11 65
-1 -1
64 65
-1 -1
-1 -1
-1 -1
37 5
-1 -1
-1 -1
68 13
-1 -1
68 40
68 38
-1 -1
68 77
-1 -1
-1 -1
39 29
-1 -1
-1 -1
-1 -1
68 3...

output:

? 2 67 13
? 3 67 13 42
? 4 67 13 42 72
? 5 67 13 42 72 29
? 6 67 13 42 72 29 54
? 7 67 13 42 72 29 54 40
? 6 67 13 42 29 54 40
? 7 67 13 42 72 29 54 11
? 6 67 13 42 72 29 11
? 2 40 11
? 7 67 13 42 72 29 54 2
? 3 40 11 2
? 7 67 13 42 72 29 54 77
? 6 67 13 42 29 54 77
? 4 40 11 2 77
? 3 40 2 77
? 7 67...

result:

ok correct

Test #22:

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

input:

81
-1 -1
61 25
-1 -1
65 25
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
65 71
-1 -1
71 44
-1 -1
65 44
61 44
25 26
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
36 26
-1 -1
-1 -1
65 66
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
37 36
65 37
60 37
-1 -1
-1 -1
28 71
-1 -1
60 28
-1 -1
28 44
-1 -1
38 29
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 ...

output:

? 2 38 25
? 3 38 25 61
? 2 38 61
? 3 38 25 65
? 2 38 65
? 2 61 65
? 3 38 25 17
? 3 61 65 17
? 4 38 25 17 71
? 3 61 65 71
? 2 61 71
? 5 38 25 17 71 44
? 4 38 25 17 44
? 3 61 65 44
? 2 61 44
? 5 38 25 17 71 26
? 4 38 17 71 26
? 3 61 65 26
? 2 44 26
? 5 38 25 17 71 36
? 3 61 65 36
? 3 44 26 36
? 2 44 3...

result:

ok correct

Test #23:

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

input:

93
-1 -1
66 21
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
2 21
2 41
-1 -1
2 79
-1 -1
79 41
-1 -1
-1 -1
-1 -1
-1 -1
66 18
-1 -1
-1 -1
79 18
-1 -1
2 22
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
54 66
2 54
-1 -1
54 18
54 41
-1 -1
54 22
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
79...

output:

? 2 47 66
? 3 47 66 21
? 2 47 21
? 3 47 66 58
? 2 21 58
? 3 47 66 67
? 3 21 58 67
? 4 47 66 67 41
? 3 21 58 41
? 4 47 66 67 2
? 4 21 58 41 2
? 3 58 41 2
? 2 58 2
? 5 47 66 67 2 79
? 4 47 66 67 79
? 4 21 58 41 79
? 3 21 58 79
? 5 47 66 67 2 32
? 4 21 58 41 32
? 2 79 32
? 5 47 66 67 2 18
? 4 47 67 2 1...

result:

ok correct

Test #24:

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

input:

37
6 20
-1 -1
30 20
-1 -1
20 5
30 24
-1 -1
24 20
6 25
30 25
-1 -1
25 20
25 24
36 30
-1 -1
36 20
36 24
36 25
5 34
-1 -1
-1 -1
24 34
25 34
36 34
30 15
-1 -1
15 34
-1 -1
24 15
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
32 20
32 34
32 31
24 32
25 32
-1 -1
-1 -1
30 26
6 26
5 26
26 34
-1 -1
31 26
-1 ...

output:

? 2 6 20
? 2 6 30
? 2 20 30
? 3 6 30 5
? 2 20 5
? 4 6 30 5 24
? 3 6 5 24
? 2 20 24
? 4 6 30 5 25
? 3 30 5 25
? 2 5 25
? 2 20 25
? 2 24 25
? 4 6 30 5 36
? 3 6 5 36
? 2 20 36
? 2 24 36
? 2 25 36
? 4 6 30 5 34
? 3 6 30 34
? 2 20 34
? 2 24 34
? 2 25 34
? 2 36 34
? 4 6 30 5 15
? 3 6 5 15
? 3 20 34 15
? 2...

result:

ok correct

Test #25:

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

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
82 137
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
79 121
-1 -1
-1 -1
-1 -1
-1 -1
...

output:

? 2 30 41
? 3 30 41 107
? 4 30 41 107 58
? 5 30 41 107 58 91
? 6 30 41 107 58 91 115
? 7 30 41 107 58 91 115 105
? 8 30 41 107 58 91 115 105 51
? 9 30 41 107 58 91 115 105 51 106
? 10 30 41 107 58 91 115 105 51 106 127
? 11 30 41 107 58 91 115 105 51 106 127 34
? 12 30 41 107 58 91 115 105 51 106 12...

result:

ok correct

Test #26:

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

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
507 396
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
516 211
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -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 103 331
? 3 103 331 558
? 4 103 331 558 428
? 5 103 331 558 428 448
? 6 103 331 558 428 448 317
? 7 103 331 558 428 448 317 453
? 8 103 331 558 428 448 317 453 130
? 9 103 331 558 428 448 317 453 130 275
? 10 103 331 558 428 448 317 453 130 275 220
? 11 103 331 558 428 448 317 453 130 275 220 50...

result:

ok correct

Test #27:

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

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
483 14
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
574 196
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
197 555
-1 -1
-1 -1
-1 -1
-1 ...

output:

? 2 122 542
? 3 122 542 163
? 4 122 542 163 489
? 5 122 542 163 489 305
? 6 122 542 163 489 305 234
? 7 122 542 163 489 305 234 528
? 8 122 542 163 489 305 234 528 90
? 9 122 542 163 489 305 234 528 90 183
? 10 122 542 163 489 305 234 528 90 183 324
? 11 122 542 163 489 305 234 528 90 183 324 347
? ...

result:

ok correct

Test #28:

score: -100
Wrong Answer
time: 60ms
memory: 3784kb

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
492 54
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
626 60...

output:

? 2 603 391
? 3 603 391 171
? 4 603 391 171 245
? 5 603 391 171 245 871
? 6 603 391 171 245 871 75
? 7 603 391 171 245 871 75 39
? 8 603 391 171 245 871 75 39 507
? 9 603 391 171 245 871 75 39 507 102
? 10 603 391 171 245 871 75 39 507 102 600
? 11 603 391 171 245 871 75 39 507 102 600 550
? 12 603 ...

result:

wrong answer Query Limit Exceeded (lim = 5000)