QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#496863#4218. Hidden GraphhazeWA 94ms5896kbC++235.1kb2024-07-28 16:36:242024-07-28 16:36:25

Judging History

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

  • [2024-07-28 16:36:25]
  • 评测
  • 测评结果:WA
  • 用时:94ms
  • 内存:5896kb
  • [2024-07-28 16:36:24]
  • 提交

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

input:

3
2 3
1 3
1 2

output:

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

result:

ok correct

Test #2:

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

input:

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

output:

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

result:

ok correct

Test #3:

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

input:

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

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
! 7
5 1
2 1
5 2
3 1
3 2
4 1
4 2

result:

ok correct

Test #4:

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

input:

3
1 3
-1 -1
2 1

output:

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

result:

ok correct

Test #5:

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

input:

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

output:

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

result:

ok correct

Test #6:

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

input:

27
5 19
5 26
19 26
5 13
19 13
26 13
-1 -1
-1 -1
-1 -1
-1 -1
3 5
3 19
-1 -1
-1 -1
1 5
1 19
-1 -1
3 1
1 9
-1 -1
-1 -1
-1 -1
-1 -1
10 13
-1 -1
21 5
21 19
21 1
-1 -1
3 21
-1 -1
-1 -1
19 16
10 16
-1 -1
-1 -1
-1 -1
2 5
2 19
2 26
-1 -1
3 2
-1 -1
21 2
-1 -1
-1 -1
-1 -1
10 15
-1 -1
3 15
-1 -1
-1 -1
-1 -1
-1 ...

output:

? 2 5 19
? 2 5 26
? 2 19 26
? 2 5 13
? 2 19 13
? 2 26 13
? 2 5 9
? 2 19 9
? 2 26 9
? 2 13 9
? 2 5 3
? 2 19 3
? 2 26 3
? 3 13 9 3
? 2 5 1
? 2 19 1
? 2 26 1
? 4 13 9 3 1
? 3 13 9 1
? 2 13 1
? 2 5 10
? 2 19 10
? 3 26 1 10
? 4 13 9 3 10
? 3 9 3 10
? 2 5 21
? 2 19 21
? 4 26 1 10 21
? 3 26 10 21
? 4 13 9 ...

result:

ok correct

Test #7:

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

input:

47
-1 -1
-1 -1
43 33
-1 -1
19 26
43 19
-1 -1
19 33
-1 -1
-1 -1
-1 -1
26 24
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
41 37
6 37
-1 -1
-1 -1
-1 -1
19 42
-1 -1
-1 -1
13 42
-1 -1
-1 -1
43 11
11 26
-1 -1
42 11
-1 -1
13 11
-1 -1
-1 -1
-1 -1
-1 -1
11 35
-1 -1
33 32
-1 -1
6 32
-1 -1
-1 -1
-1 -1
-1 -1...

output:

? 2 43 26
? 3 43 26 38
? 4 43 26 38 33
? 3 26 38 33
? 4 43 26 38 19
? 3 43 38 19
? 2 38 19
? 2 33 19
? 4 43 26 38 41
? 2 33 41
? 2 19 41
? 4 43 26 38 24
? 3 43 38 24
? 2 33 24
? 3 19 41 24
? 4 43 26 38 6
? 2 33 6
? 4 19 41 24 6
? 4 43 26 38 37
? 2 33 37
? 5 19 41 24 6 37
? 4 19 24 6 37
? 3 19 24 37
...

result:

ok correct

Test #8:

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

input:

38
-1 -1
-1 -1
-1 -1
11 14
-1 -1
37 32
11 37
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
29 22
-1 -1
13 32
11 13
-1 -1
37 13
-1 -1
-1 -1
38 14
38 37
-1 -1
38 13
11 1
-1 -1
1 14
37 1
-1 -1
13 1
-1 -1
-1 -1
-1 -1
-1 -1
15 32
15 20
-1 -1
15 22
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
13 25
-1 -1
-1 -1
18 22
37 18
14 18
-1 -1
-...

output:

? 2 11 10
? 3 11 10 32
? 4 11 10 32 20
? 5 11 10 32 20 14
? 4 10 32 20 14
? 5 11 10 32 20 37
? 4 11 10 20 37
? 3 10 20 37
? 2 14 37
? 5 11 10 32 20 22
? 3 14 37 22
? 5 11 10 32 20 29
? 4 14 37 22 29
? 3 14 37 29
? 6 11 10 32 20 29 13
? 5 11 10 20 29 13
? 4 10 20 29 13
? 4 14 37 22 13
? 3 14 22 13
? ...

result:

ok correct

Test #9:

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

input:

25
-1 -1
4 8
-1 -1
9 8
9 11
9 4
10 11
-1 -1
-1 -1
-1 -1
8 25
-1 -1
4 25
-1 -1
5 8
-1 -1
5 4
-1 -1
19 11
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
25 24
-1 -1
-1 -1
4 17
-1 -1
10 17
-1 -1
-1 -1
4 22
-1 -1
-1 -1
-1 -1
12 4
-1 -1
12 25
-1 -1
-1 -1
-1 -1
20 22
20 9
-1 -1
13 8
-1 -1
20 13
-1 -1
13 19
5 13
13 22
-1 -...

output:

? 2 8 11
? 3 8 11 4
? 2 11 4
? 3 8 11 9
? 2 11 9
? 2 4 9
? 3 8 11 10
? 2 8 10
? 2 4 10
? 2 9 10
? 3 8 11 25
? 2 11 25
? 2 4 25
? 3 9 10 25
? 3 8 11 5
? 2 11 5
? 2 4 5
? 4 9 10 25 5
? 3 8 11 19
? 2 8 19
? 2 4 19
? 5 9 10 25 5 19
? 3 8 11 24
? 2 4 24
? 6 9 10 25 5 19 24
? 5 9 10 5 19 24
? 3 8 11 17
? ...

result:

ok correct

Test #10:

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

input:

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

output:

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

result:

ok correct

Test #11:

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

input:

3
3 1
2 1
2 3

output:

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

result:

ok correct

Test #12:

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

input:

3
-1 -1
2 1
3 1

output:

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

result:

ok correct

Test #13:

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

input:

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

output:

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

result:

ok correct

Test #14:

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

input:

3
2 1
-1 -1
-1 -1

output:

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

result:

ok correct

Test #15:

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

input:

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

output:

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

result:

ok correct

Test #16:

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

input:

93
49 43
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
92 13
-1 -1
-1 -1
-1 -1
-1 -1
3 86
-1 -1
-1 -1
-1 -1
-1 -1
18 89
-1 -1
-1 -1
27 77
77 86
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
88 43
88 89
88 21
-1 -1
-1 -1
43 70
70 86
70 21
-1 -1
-1 -1
43 31
-1 -1
70 38
-1 -1
27 38
-1 -1
31 9...

output:

? 2 49 43
? 2 49 92
? 2 43 92
? 2 49 86
? 3 43 92 86
? 2 49 27
? 4 43 92 86 27
? 2 49 89
? 5 43 92 86 27 89
? 2 49 21
? 6 43 92 86 27 89 21
? 2 49 13
? 7 43 92 86 27 89 21 13
? 6 43 86 27 89 21 13
? 3 49 13 17
? 7 43 92 86 27 89 21 17
? 3 49 13 3
? 8 43 92 86 27 89 21 17 3
? 7 43 92 27 89 21 17 3
? ...

result:

ok correct

Test #17:

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

input:

111
-1 -1
11 75
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
75 41
-1 -1
11 41
-1 -1
-1 -1
43 74
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
11 19
-1 -1
19 60
-1 -1
93 33
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
24 74
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
85 10
-1 -1
-1 -1
-1 -1
85 27
27 41
27 36
-1 -1
-1 -1
24 90
-1...

output:

? 2 75 33
? 3 75 33 11
? 2 33 11
? 3 75 33 102
? 2 11 102
? 3 75 33 43
? 3 11 102 43
? 3 75 33 41
? 2 33 41
? 4 11 102 43 41
? 3 102 43 41
? 3 75 33 74
? 4 11 102 43 74
? 3 11 102 74
? 2 41 74
? 3 75 33 60
? 4 11 102 43 60
? 3 41 74 60
? 3 75 33 19
? 4 11 102 43 19
? 3 102 43 19
? 4 41 74 60 19
? 3 ...

result:

ok correct

Test #18:

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

input:

132
124 66
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
10 63
-1 -1
-1 -1
-1 -1
-1 -1
124 130
-1 -1
-1 -1
-1 -1
104 10
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
124 7
-1 -1
66 48
130 48
48 10
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
4 48
-1 -1
-1 -1
-1 -1
4 32
130 32
-1 -1
32 34
-1 -1
130 21
-1 -1
21 48
21 36
-1 ...

output:

? 2 66 124
? 2 66 63
? 2 124 63
? 2 66 34
? 3 124 63 34
? 2 66 10
? 4 124 63 34 10
? 3 124 34 10
? 3 66 10 26
? 4 124 63 34 26
? 3 66 10 130
? 5 124 63 34 26 130
? 4 63 34 26 130
? 4 66 10 130 91
? 5 124 63 34 26 91
? 4 66 10 130 104
? 3 66 130 104
? 6 124 63 34 26 91 104
? 4 66 10 130 37
? 7 124 63...

result:

ok correct

Test #19:

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

input:

94
39 42
42 16
-1 -1
-1 -1
-1 -1
-1 -1
39 69
-1 -1
-1 -1
-1 -1
42 55
-1 -1
39 55
-1 -1
21 69
-1 -1
21 37
39 21
-1 -1
-1 -1
-1 -1
-1 -1
4 21
-1 -1
-1 -1
4 71
71 37
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
52 16
-1 -1
-1 -1
-1 -1
20 29
-1 -1
-1 -1
42 70
-1 -1
70 37
70 4
-1 -1
-1 -1
27 42
27 69
27 16
-1 -1
...

output:

? 2 42 39
? 2 42 16
? 2 39 16
? 2 42 37
? 3 39 16 37
? 2 42 69
? 4 39 16 37 69
? 3 16 37 69
? 3 42 69 29
? 4 39 16 37 29
? 3 42 69 55
? 2 69 55
? 5 39 16 37 29 55
? 4 16 37 29 55
? 3 42 69 21
? 2 42 21
? 5 39 16 37 29 21
? 4 39 16 29 21
? 3 16 29 21
? 2 55 21
? 3 42 69 4
? 5 39 16 37 29 4
? 3 55 21 ...

result:

ok correct

Test #20:

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

input:

73
-1 -1
-1 -1
1 29
1 72
-1 -1
4 72
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
63 72
-1 -1
63 69
-1 -1
72 42
-1 -1
4 42
-1 -1
-1 -1
71 43
-1 -1
-1 -1
-1 -1
-1 -1
54 65
-1 -1
-1 -1
60 72
-1 -1
-1 -1
60 43
-1 -1
72 9
-1 -1
60 9
1 9
-1 -1
63 9
9 65
-1 -1
29 38
-1 -1
-1 -1
42 38
-1 -1
-1 -1
29 20
-...

output:

? 2 72 71
? 3 72 71 29
? 4 72 71 29 1
? 3 72 71 1
? 2 71 1
? 4 72 71 29 4
? 3 71 29 4
? 2 1 4
? 4 72 71 29 69
? 3 1 4 69
? 4 72 71 29 54
? 4 1 4 69 54
? 4 72 71 29 18
? 5 1 4 69 54 18
? 4 72 71 29 63
? 3 71 29 63
? 6 1 4 69 54 18 63
? 5 1 4 54 18 63
? 4 72 71 29 42
? 3 71 29 42
? 6 1 4 69 54 18 42
?...

result:

ok correct

Test #21:

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

input:

77
-1 -1
-1 -1
21 68
68 6
-1 -1
66 21
-1 -1
-1 -1
16 21
16 35
-1 -1
16 66
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
64 65
-1 -1
21 22
-1 -1
-1 -1
16 22
-1 -1
-1 -1
66 33
-1 -1
-1 -1
52 21
52 35
-1 -1
52 22
66 52
-1 -1
-1 -1
-1 -1
74 22
66 74
-1 -1
16 74
-1 -1
-1 -1
66 18
-1 -1
18 33
-1 -1
-1 -1
76 22
-1 -...

output:

? 2 6 21
? 3 6 21 35
? 4 6 21 35 68
? 3 6 35 68
? 2 35 68
? 4 6 21 35 66
? 3 6 35 66
? 2 68 66
? 4 6 21 35 16
? 3 6 35 16
? 2 6 16
? 3 68 66 16
? 2 68 16
? 4 6 21 35 65
? 3 68 66 65
? 2 16 65
? 4 6 21 35 64
? 3 68 66 64
? 3 16 65 64
? 2 16 64
? 4 6 21 35 22
? 3 6 35 22
? 4 68 66 64 22
? 3 16 65 22
?...

result:

ok correct

Test #22:

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

input:

81
-1 -1
-1 -1
50 78
-1 -1
73 34
-1 -1
-1 -1
50 42
-1 -1
-1 -1
50 27
-1 -1
42 27
-1 -1
50 21
73 21
-1 -1
78 21
21 34
-1 -1
-1 -1
73 35
-1 -1
42 35
35 34
-1 -1
35 21
-1 -1
-1 -1
-1 -1
27 5
-1 -1
-1 -1
50 47
73 47
-1 -1
47 34
-1 -1
47 27
-1 -1
47 35
-1 -1
-1 -1
-1 -1
14 21
-1 -1
-1 -1
-1 -1
50 68
-1 -...

output:

? 2 73 77
? 3 73 77 50
? 4 73 77 50 78
? 3 73 77 78
? 4 73 77 50 34
? 3 77 50 34
? 2 78 34
? 4 73 77 50 42
? 3 73 77 42
? 3 78 34 42
? 4 73 77 50 27
? 3 73 77 27
? 4 78 34 42 27
? 3 78 34 27
? 4 73 77 50 21
? 3 73 77 21
? 2 77 21
? 4 78 34 42 21
? 3 34 42 21
? 2 42 21
? 2 27 21
? 4 73 77 50 35
? 3 7...

result:

ok correct

Test #23:

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

input:

93
-1 -1
-1 -1
-1 -1
-1 -1
29 32
32 90
-1 -1
57 90
57 29
-1 -1
-1 -1
-1 -1
45 32
45 57
-1 -1
57 88
-1 -1
-1 -1
-1 -1
82 29
45 82
-1 -1
82 32
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
82 64
-1 -1
29 56
88 56
-1 -1
-1 -1
-1 -1
90 37
45 37
-1 -1
57 37
-1 -1
-1 -1
38 92
45 38
-1 -1
57 38
-1 -1
38 37
38 82
-1 ...

output:

? 2 92 29
? 3 92 29 90
? 4 92 29 90 73
? 5 92 29 90 73 65
? 6 92 29 90 73 65 32
? 5 92 90 73 65 32
? 4 92 73 65 32
? 6 92 29 90 73 65 57
? 5 92 29 73 65 57
? 4 92 73 65 57
? 2 32 57
? 6 92 29 90 73 65 45
? 3 32 57 45
? 2 57 45
? 7 92 29 90 73 65 45 88
? 3 32 57 88
? 2 32 88
? 8 92 29 90 73 65 45 88 ...

result:

ok correct

Test #24:

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

input:

37
-1 -1
-1 -1
23 10
6 23
-1 -1
28 16
6 28
-1 -1
23 28
6 9
9 16
-1 -1
9 23
9 28
6 18
10 18
18 16
23 18
28 18
9 18
-1 -1
19 23
-1 -1
-1 -1
19 18
10 34
-1 -1
23 34
28 34
19 34
9 34
18 34
-1 -1
-1 -1
-1 -1
-1 -1
17 18
17 34
15 10
-1 -1
15 23
15 28
15 17
15 19
-1 -1
15 18
15 34
30 16
-1 -1
30 23
-1 -1
3...

output:

? 2 6 10
? 3 6 10 16
? 4 6 10 16 23
? 3 6 16 23
? 2 16 23
? 4 6 10 16 28
? 3 6 10 28
? 2 10 28
? 2 23 28
? 4 6 10 16 9
? 3 10 16 9
? 2 10 9
? 2 23 9
? 2 28 9
? 4 6 10 16 18
? 3 10 16 18
? 2 16 18
? 2 23 18
? 2 28 18
? 2 9 18
? 4 6 10 16 19
? 2 23 19
? 2 28 19
? 2 9 19
? 2 18 19
? 4 6 10 16 34
? 3 6 ...

result:

ok correct

Test #25:

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

input:

144
-1 -1
-1 -1
86 3
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-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 17
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 ...

output:

? 2 86 73
? 3 86 73 136
? 4 86 73 136 3
? 3 73 136 3
? 4 86 73 136 139
? 2 3 139
? 4 86 73 136 44
? 3 3 139 44
? 4 86 73 136 67
? 4 3 139 44 67
? 4 86 73 136 30
? 5 3 139 44 67 30
? 4 86 73 136 38
? 6 3 139 44 67 30 38
? 4 86 73 136 97
? 7 3 139 44 67 30 38 97
? 4 86 73 136 131
? 8 3 139 44 67 30 38...

result:

ok correct

Test #26:

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

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

output:

? 2 323 16
? 3 323 16 149
? 4 323 16 149 128
? 5 323 16 149 128 320
? 6 323 16 149 128 320 120
? 7 323 16 149 128 320 120 5
? 8 323 16 149 128 320 120 5 246
? 9 323 16 149 128 320 120 5 246 489
? 10 323 16 149 128 320 120 5 246 489 339
? 11 323 16 149 128 320 120 5 246 489 339 561
? 12 323 16 149 12...

result:

ok correct

Test #27:

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

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
398 391
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
112 332
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
291 595
-1 -1
-1 -1
-1...

output:

? 2 107 164
? 3 107 164 145
? 4 107 164 145 642
? 5 107 164 145 642 349
? 6 107 164 145 642 349 186
? 7 107 164 145 642 349 186 391
? 8 107 164 145 642 349 186 391 660
? 9 107 164 145 642 349 186 391 660 25
? 10 107 164 145 642 349 186 391 660 25 215
? 11 107 164 145 642 349 186 391 660 25 215 331
?...

result:

ok correct

Test #28:

score: -100
Wrong Answer
time: 94ms
memory: 5820kb

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
-1 -1
-1 -1
-1 -1
-1 -1
869 545
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-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 523 77
? 3 523 77 998
? 4 523 77 998 17
? 5 523 77 998 17 880
? 6 523 77 998 17 880 461
? 7 523 77 998 17 880 461 345
? 8 523 77 998 17 880 461 345 170
? 9 523 77 998 17 880 461 345 170 360
? 10 523 77 998 17 880 461 345 170 360 371
? 11 523 77 998 17 880 461 345 170 360 371 167
? 12 523 77 998 ...

result:

wrong answer Query Limit Exceeded (lim = 5000)