QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#496860#4218. Hidden GraphhazeWA 176ms6416kbC++235.1kb2024-07-28 16:35:292024-07-28 16:35:31

Judging History

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

  • [2024-07-28 16:35:31]
  • 评测
  • 测评结果:WA
  • 用时:176ms
  • 内存:6416kb
  • [2024-07-28 16:35:29]
  • 提交

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)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: 5864kb

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

input:

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

output:

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

result:

ok correct

Test #3:

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

input:

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

output:

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

result:

ok correct

Test #4:

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

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: 1ms
memory: 5696kb

input:

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

output:

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

result:

ok correct

Test #6:

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

input:

27
-1 -1
3 17
-1 -1
-1 -1
-1 -1
10 8
-1 -1
-1 -1
-1 -1
-1 -1
3 2
-1 -1
2 27
-1 -1
14 8
-1 -1
-1 -1
-1 -1
3 19
-1 -1
19 27
-1 -1
14 19
2 19
3 5
-1 -1
5 27
-1 -1
14 5
2 5
5 19
3 21
21 8
21 17
21 27
-1 -1
21 2
-1 -1
21 19
21 5
6 8
-1 -1
-1 -1
6 14
-1 -1
6 19
-1 -1
-1 -1
8 13
-1 -1
10 13
-1 -1
-1 -1
19 ...

output:

? 2 3 8
? 3 3 8 17
? 2 8 17
? 3 3 8 27
? 2 17 27
? 3 3 8 10
? 2 3 10
? 3 17 27 10
? 3 3 8 7
? 4 17 27 10 7
? 3 3 8 2
? 2 8 2
? 5 17 27 10 7 2
? 4 17 10 7 2
? 3 3 8 14
? 2 3 14
? 5 17 27 10 7 14
? 2 2 14
? 3 3 8 19
? 2 8 19
? 5 17 27 10 7 19
? 4 17 10 7 19
? 3 2 14 19
? 2 2 19
? 3 3 8 5
? 2 8 5
? 5 1...

result:

ok correct

Test #7:

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

input:

47
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
28 40
40 4
-1 -1
20 12
-1 -1
-1 -1
-1 -1
20 32
-1 -1
6 32
-1 -1
20 6
40 6
12 3
-1 -1
40 3
-1 -1
-1 -1
27 28
-1 -1
27 40
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
20 24
-1 -1
-1 -1
7 12
-1 -1
20 7
-1 -1
27 7
7 24
7 6
13 7
-1 -1
2 12
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1...

output:

? 2 38 14
? 3 38 14 47
? 4 38 14 47 4
? 5 38 14 47 4 12
? 6 38 14 47 4 12 35
? 7 38 14 47 4 12 35 28
? 8 38 14 47 4 12 35 28 40
? 7 38 14 47 4 12 35 40
? 6 38 14 47 12 35 40
? 8 38 14 47 4 12 35 28 20
? 7 38 14 47 4 35 28 20
? 2 40 20
? 8 38 14 47 4 12 35 28 32
? 3 40 20 32
? 2 40 32
? 9 38 14 47 4 ...

result:

ok correct

Test #8:

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

input:

38
-1 -1
-1 -1
-1 -1
11 14
38 14
-1 -1
-1 -1
-1 -1
38 2
-1 -1
-1 -1
8 21
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
2 25
-1 -1
13 25
38 13
11 13
13 8
-1 -1
13 32
-1 -1
16 25
-1 -1
16 20
-1 -1
16 13
23 25
-1 -1
-1 -1
-1 -1
16 23
11 1
-1 -1
1 14
-1 -1
1 23
13 1
-1 -1
-1 -1
18 22
14 18
-1 -1
-1 -1
-1 -1...

output:

? 2 38 30
? 3 38 30 11
? 4 38 30 11 8
? 5 38 30 11 8 14
? 4 38 30 8 14
? 3 30 8 14
? 5 38 30 11 8 32
? 2 14 32
? 5 38 30 11 8 2
? 4 30 11 8 2
? 3 14 32 2
? 5 38 30 11 8 21
? 4 38 30 11 21
? 4 14 32 2 21
? 5 38 30 11 8 22
? 5 14 32 2 21 22
? 5 38 30 11 8 20
? 6 14 32 2 21 22 20
? 5 38 30 11 8 25
? 7 ...

result:

ok correct

Test #9:

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

input:

25
7 19
-1 -1
-1 -1
7 3
-1 -1
-1 -1
-1 -1
-1 -1
6 24
-1 -1
7 25
25 24
25 3
6 25
-1 -1
-1 -1
19 11
-1 -1
-1 -1
7 13
-1 -1
13 19
6 13
-1 -1
-1 -1
-1 -1
22 3
6 22
-1 -1
13 22
-1 -1
16 7
-1 -1
16 3
-1 -1
16 13
-1 -1
7 14
14 22
-1 -1
14 3
-1 -1
14 13
14 25
-1 -1
16 14
-1 -1
-1 -1
9 11
-1 -1
16 9
-1 -1
22...

output:

? 2 7 19
? 2 7 6
? 2 19 6
? 2 7 3
? 3 19 6 3
? 2 7 1
? 4 19 6 3 1
? 2 7 24
? 5 19 6 3 1 24
? 4 19 3 1 24
? 3 7 24 25
? 2 24 25
? 5 19 6 3 1 25
? 4 19 6 1 25
? 3 19 1 25
? 3 7 24 11
? 5 19 6 3 1 11
? 4 6 3 1 11
? 2 25 11
? 3 7 24 13
? 2 24 13
? 5 19 6 3 1 13
? 4 6 3 1 13
? 3 3 1 13
? 3 25 11 13
? 3 7...

result:

ok correct

Test #10:

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

input:

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

output:

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

result:

ok correct

Test #11:

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

input:

3
2 1
2 3
3 1

output:

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

result:

ok correct

Test #12:

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

input:

3
2 1
3 1
-1 -1

output:

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

result:

ok correct

Test #13:

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

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

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

input:

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

output:

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

result:

ok correct

Test #16:

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

input:

93
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
82 15
-1 -1
43 69
55 43
-1 -1
-1 -1
70 69
70 86
-1 -1
43 70
-1 -1
-1 -1
-1 -1
-1 -1
1 93
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 23
-1 -1
-1 -1
-1 -1
-1 -1
3 86
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
55 22
-1 -1
43 22
-1 -1
-1 -1
-1 -1
43 79
-1 -1
-1 -1
55 50
...

output:

? 2 92 69
? 3 92 69 93
? 4 92 69 93 82
? 5 92 69 93 82 55
? 6 92 69 93 82 55 86
? 7 92 69 93 82 55 86 15
? 6 92 69 93 55 86 15
? 7 92 69 93 82 55 86 43
? 6 92 93 82 55 86 43
? 5 92 93 82 86 43
? 2 15 43
? 7 92 69 93 82 55 86 70
? 6 92 93 82 55 86 70
? 5 92 93 82 55 70
? 3 15 43 70
? 2 15 70
? 7 92 6...

result:

ok correct

Test #17:

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

input:

111
-1 -1
-1 -1
-1 -1
83 12
-1 -1
54 55
83 54
-1 -1
-1 -1
-1 -1
-1 -1
56 103
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
54 11
12 11
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
65 56
-1 -1
65 54
65 12
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
110 11
-1 -1
12 110
-1 -1
65 110
-1 -1
83 66
-1 -1
66 54
66 12
-1 -1
66 65
-1 -1
-1 -...

output:

? 2 17 56
? 3 17 56 55
? 4 17 56 55 83
? 5 17 56 55 83 12
? 4 17 56 55 12
? 5 17 56 55 83 54
? 4 17 56 83 54
? 3 17 56 54
? 2 12 54
? 5 17 56 55 83 31
? 3 12 54 31
? 5 17 56 55 83 103
? 4 17 55 83 103
? 4 12 54 31 103
? 5 17 56 55 83 86
? 5 12 54 31 103 86
? 5 17 56 55 83 11
? 6 12 54 31 103 86 11
?...

result:

ok correct

Test #18:

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

input:

132
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
12 111
118 111
106 111
105 111
-1 -1
-1 -1
-1 -1
83 65
-1 -1
-1 -1
-1 -1
-1 -1
89 88
-1 -1
88 65
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
98 36
-1 -1
-1 -1
-1 -1
108 96
-1 -1
-1 -1
81 106
-1 -1
-1 -1
53 81
98 81
-1 -1
118 57
12 57
-1 -1
-1 -1
-1 -1
74 105
-1 -1
74 ...

output:

? 2 66 118
? 3 66 118 105
? 4 66 118 105 106
? 5 66 118 105 106 12
? 6 66 118 105 106 12 83
? 7 66 118 105 106 12 83 42
? 8 66 118 105 106 12 83 42 89
? 9 66 118 105 106 12 83 42 89 111
? 8 66 118 105 106 83 42 89 111
? 7 66 105 106 83 42 89 111
? 6 66 105 83 42 89 111
? 5 66 83 42 89 111
? 9 66 118...

result:

ok correct

Test #19:

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

input:

94
-1 -1
-1 -1
73 5
-1 -1
42 73
-1 -1
-1 -1
-1 -1
5 75
-1 -1
-1 -1
-1 -1
73 57
-1 -1
-1 -1
73 61
61 75
-1 -1
61 79
42 61
-1 -1
-1 -1
-1 -1
-1 -1
14 73
-1 -1
14 42
14 57
-1 -1
14 91
-1 -1
-1 -1
79 18
-1 -1
-1 -1
-1 -1
72 75
73 72
-1 -1
72 5
-1 -1
72 61
-1 -1
-1 -1
73 29
-1 -1
-1 -1
-1 -1
-1 -1
73 1
-...

output:

? 2 73 89
? 3 73 89 64
? 4 73 89 64 5
? 3 89 64 5
? 4 73 89 64 42
? 3 89 64 42
? 2 5 42
? 4 73 89 64 75
? 3 5 42 75
? 2 42 75
? 5 73 89 64 75 79
? 3 5 42 79
? 5 73 89 64 75 57
? 4 89 64 75 57
? 4 5 42 79 57
? 5 73 89 64 75 61
? 4 89 64 75 61
? 3 89 64 61
? 5 5 42 79 57 61
? 4 5 42 57 61
? 3 5 57 61
...

result:

ok correct

Test #20:

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

input:

73
73 38
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
72 73
-1 -1
72 26
-1 -1
3 26
-1 -1
72 16
-1 -1
3 16
-1 -1
-1 -1
30 38
-1 -1
-1 -1
30 26
-1 -1
60 72
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
38 5
-1 -1
-1 -1
-1 -1
72 6
-1 -1
73 6
-1 -1
-1 -1
-1 -1
-1 -1
6 43
60 43
-1 -1
-1 -1
-1 -1
25 6
25 26
25 16
-1 -1
-1 -1
73 2...

output:

? 2 38 73
? 2 38 33
? 2 73 33
? 2 38 3
? 3 73 33 3
? 2 38 72
? 4 73 33 3 72
? 3 33 3 72
? 3 38 72 26
? 2 38 26
? 4 73 33 3 26
? 3 73 33 26
? 3 38 72 16
? 2 38 16
? 4 73 33 3 16
? 3 73 33 16
? 2 26 16
? 3 38 72 30
? 2 72 30
? 4 73 33 3 30
? 3 26 16 30
? 2 16 30
? 3 38 72 60
? 2 38 60
? 5 73 33 3 30 6...

result:

ok correct

Test #21:

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

input:

77
3 8
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
8 77
-1 -1
-1 -1
68 77
68 38
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
75 68
75 8
75 3
75 34
75 71
-1 -1
8 73
-1 -1
3 73
34 73
-1 -1
-1 -1
-1 -1
-1 -1
73 54
-1 -1
-1 -1
77 11
11 54
-1 -1
73 11
-1 -1
-1 -1
-1 -1
-1 -1
-1 -...

output:

? 2 8 3
? 2 8 27
? 2 3 27
? 2 8 19
? 3 3 27 19
? 2 8 74
? 4 3 27 19 74
? 2 8 38
? 5 3 27 19 74 38
? 2 8 37
? 6 3 27 19 74 38 37
? 2 8 71
? 7 3 27 19 74 38 37 71
? 2 8 29
? 8 3 27 19 74 38 37 71 29
? 2 8 77
? 9 3 27 19 74 38 37 71 29 77
? 2 8 68
? 10 3 27 19 74 38 37 71 29 77 68
? 9 3 27 19 74 38 37 ...

result:

ok correct

Test #22:

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

input:

81
-1 -1
-1 -1
37 56
-1 -1
6 12
-1 -1
-1 -1
41 34
-1 -1
-1 -1
-1 -1
-1 -1
30 37
-1 -1
30 12
-1 -1
2 37
-1 -1
2 27
2 56
2 12
2 41
-1 -1
-1 -1
-1 -1
-1 -1
66 6
-1 -1
-1 -1
-1 -1
6 26
-1 -1
-1 -1
-1 -1
-1 -1
43 27
-1 -1
30 43
-1 -1
75 43
-1 -1
75 12
-1 -1
2 75
75 26
30 75
49 75
-1 -1
-1 -1
-1 -1
66 24
...

output:

? 2 37 6
? 3 37 6 34
? 4 37 6 34 56
? 3 6 34 56
? 4 37 6 34 12
? 3 37 34 12
? 2 56 12
? 4 37 6 34 41
? 3 37 6 41
? 3 56 12 41
? 4 37 6 34 27
? 4 56 12 41 27
? 4 37 6 34 30
? 3 6 34 30
? 5 56 12 41 27 30
? 4 56 41 27 30
? 4 37 6 34 2
? 3 6 34 2
? 5 56 12 41 27 2
? 4 56 12 41 2
? 3 12 41 2
? 2 41 2
? ...

result:

ok correct

Test #23:

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

input:

93
-1 -1
51 70
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
83 70
-1 -1
-1 -1
91 31
-1 -1
-1 -1
73 21
-1 -1
-1 -1
2 21
-1 -1
51 3
-1 -1
-1 -1
-1 -1
25 52
25 3
-1 -1
25 38
2 38
-1 -1
38 3
-1 -1
65 39
-1 -1
3 39
-1 -1
-1 -1
-1 -1
85 31
-1 -1
-1 -1
83 84
-1 -1
-1 -1
85 84
-1 -1
9 73
-1 -...

output:

? 2 65 51
? 3 65 51 70
? 2 65 70
? 3 65 51 67
? 2 70 67
? 3 65 51 52
? 3 70 67 52
? 3 65 51 21
? 4 70 67 52 21
? 3 65 51 31
? 5 70 67 52 21 31
? 3 65 51 83
? 6 70 67 52 21 31 83
? 5 67 52 21 31 83
? 4 65 51 83 91
? 6 70 67 52 21 31 91
? 5 70 67 52 21 91
? 5 65 51 83 91 73
? 6 70 67 52 21 31 73
? 5 7...

result:

ok correct

Test #24:

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

input:

37
-1 -1
6 13
-1 -1
-1 -1
-1 -1
10 18
13 18
6 18
18 5
33 10
-1 -1
-1 -1
33 18
23 10
-1 -1
6 23
-1 -1
23 18
-1 -1
33 30
-1 -1
30 18
30 23
13 37
30 37
-1 -1
33 37
-1 -1
37 18
23 37
12 13
-1 -1
-1 -1
12 18
12 23
12 37
15 10
30 15
-1 -1
-1 -1
15 18
15 23
15 37
14 30
-1 -1
14 5
6 14
33 14
-1 -1
-1 -1
-1 ...

output:

? 2 10 13
? 3 10 13 6
? 2 10 6
? 3 10 13 5
? 2 6 5
? 3 10 13 18
? 2 13 18
? 3 6 5 18
? 2 5 18
? 3 10 13 33
? 2 13 33
? 3 6 5 33
? 2 18 33
? 3 10 13 23
? 2 13 23
? 4 6 5 33 23
? 3 5 33 23
? 2 18 23
? 3 10 13 30
? 4 6 5 33 30
? 3 6 5 30
? 2 18 30
? 2 23 30
? 4 10 13 30 37
? 3 10 30 37
? 2 10 37
? 4 6 ...

result:

ok correct

Test #25:

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

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
106 67
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
3 50
-1 -1
-1 -1
-1 -1
86 3
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 ...

output:

? 2 36 119
? 3 36 119 126
? 4 36 119 126 106
? 5 36 119 126 106 11
? 6 36 119 126 106 11 24
? 7 36 119 126 106 11 24 132
? 8 36 119 126 106 11 24 132 111
? 9 36 119 126 106 11 24 132 111 136
? 10 36 119 126 106 11 24 132 111 136 18
? 11 36 119 126 106 11 24 132 111 136 18 15
? 12 36 119 126 106 11 2...

result:

ok correct

Test #26:

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

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
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
468 222
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-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 83 375
? 3 83 375 287
? 4 83 375 287 102
? 5 83 375 287 102 2
? 6 83 375 287 102 2 505
? 7 83 375 287 102 2 505 419
? 8 83 375 287 102 2 505 419 347
? 9 83 375 287 102 2 505 419 347 205
? 10 83 375 287 102 2 505 419 347 205 300
? 11 83 375 287 102 2 505 419 347 205 300 145
? 12 83 375 287 102 2 ...

result:

ok correct

Test #27:

score: 0
Accepted
time: 23ms
memory: 5840kb

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
-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 53 147
? 3 53 147 60
? 4 53 147 60 678
? 5 53 147 60 678 396
? 6 53 147 60 678 396 360
? 7 53 147 60 678 396 360 525
? 8 53 147 60 678 396 360 525 21
? 9 53 147 60 678 396 360 525 21 322
? 10 53 147 60 678 396 360 525 21 322 229
? 11 53 147 60 678 396 360 525 21 322 229 112
? 12 53 147 60 678 39...

result:

ok correct

Test #28:

score: -100
Wrong Answer
time: 176ms
memory: 6416kb

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
798 391
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
896 337
-1 -1
-1 -1
-1 -1
-1 ...

output:

? 2 374 548
? 3 374 548 530
? 4 374 548 530 696
? 5 374 548 530 696 391
? 6 374 548 530 696 391 148
? 7 374 548 530 696 391 148 228
? 8 374 548 530 696 391 148 228 509
? 9 374 548 530 696 391 148 228 509 920
? 10 374 548 530 696 391 148 228 509 920 384
? 11 374 548 530 696 391 148 228 509 920 384 10...

result:

wrong answer Query Limit Exceeded (lim = 5000)