QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#496895#4218. Hidden GraphhazeRE 64ms5888kbC++205.2kb2024-07-28 16:47:512024-07-28 16:47:52

Judging History

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

  • [2024-07-28 16:47:52]
  • 评测
  • 测评结果:RE
  • 用时:64ms
  • 内存:5888kb
  • [2024-07-28 16:47:51]
  • 提交

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());
int sum = 0;
array<int, 2> query(set<int>&node){
    if(node.size() == 1){
        return {-1, -1};
    }
    ++ sum;
    assert(sum <= 6000);
    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<set<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.emplace(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(i + j - u);
                auto T = query(vec);
                i = T[0], j = T[1];
            }
        }
        if(to == -1){
            col.push_back({u});
        }
        else col[to].insert(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: 5704kb

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

input:

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

output:

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

result:

ok correct

Test #3:

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

input:

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

output:

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

result:

ok correct

Test #4:

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

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

input:

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

output:

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

result:

ok correct

Test #6:

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

input:

27
-1 -1
6 14
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
22 26
-1 -1
-1 -1
-1 -1
-1 -1
14 19
-1 -1
19 26
6 19
-1 -1
2 26
-1 -1
2 19
-1 -1
-1 -1
-1 -1
4 11
22 11
-1 -1
6 11
-1 -1
19 11
22 25
-1 -1
-1 -1
-1 -1
-1 -1
3 2
3 15
-1 -1
-1 -1
3 19
-1 -1
10 15
-1 -1
-1 -1
-1 -1
-1 -1
14 5
2 5
-1 -1
3 5
5 26
-1 -1
5 19
5 ...

output:

? 2 14 22
? 3 14 22 6
? 2 22 6
? 3 14 22 23
? 2 6 23
? 4 14 22 23 4
? 2 6 4
? 5 14 22 23 4 26
? 4 14 23 4 26
? 2 6 26
? 5 14 22 23 4 15
? 3 6 26 15
? 6 14 22 23 4 15 19
? 5 22 23 4 15 19
? 3 6 26 19
? 2 6 19
? 6 14 22 23 4 15 2
? 3 6 26 2
? 2 6 2
? 2 19 2
? 7 14 22 23 4 15 2 18
? 3 6 26 18
? 2 19 18...

result:

ok correct

Test #7:

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

input:

47
21 45
-1 -1
-1 -1
-1 -1
21 38
-1 -1
21 35
-1 -1
-1 -1
-1 -1
-1 -1
40 3
-1 -1
-1 -1
46 3
-1 -1
-1 -1
18 3
-1 -1
-1 -1
45 47
-1 -1
18 47
-1 -1
43 3
43 45
-1 -1
43 18
43 21
-1 -1
-1 -1
-1 -1
27 40
27 21
-1 -1
27 43
-1 -1
-1 -1
22 21
22 18
-1 -1
22 43
-1 -1
22 7
27 7
-1 -1
18 7
21 7
7 46
-1 -1
-1 -1
...

output:

? 2 45 21
? 2 45 16
? 2 21 16
? 3 45 16 38
? 2 21 38
? 4 45 16 38 35
? 2 21 35
? 5 45 16 38 35 3
? 2 21 3
? 6 45 16 38 35 3 41
? 2 21 41
? 7 45 16 38 35 3 41 40
? 6 45 16 38 35 41 40
? 2 21 40
? 7 45 16 38 35 3 41 46
? 6 45 16 38 35 41 46
? 3 21 40 46
? 7 45 16 38 35 3 41 18
? 6 45 16 38 35 41 18
? ...

result:

ok correct

Test #8:

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

input:

38
-1 -1
-1 -1
-1 -1
-1 -1
4 1
-1 -1
-1 -1
-1 -1
26 27
-1 -1
-1 -1
4 33
28 33
-1 -1
-1 -1
24 4
-1 -1
24 33
24 1
-1 -1
38 4
38 2
-1 -1
-1 -1
38 24
2 17
4 17
-1 -1
-1 -1
-1 -1
11 28
11 4
-1 -1
11 1
-1 -1
11 24
28 22
-1 -1
33 22
-1 -1
-1 -1
-1 -1
37 32
37 4
-1 -1
38 37
37 1
37 33
-1 -1
37 24
-1 -1
11 3...

output:

? 2 28 2
? 3 28 2 32
? 4 28 2 32 4
? 5 28 2 32 4 36
? 6 28 2 32 4 36 1
? 5 28 2 32 36 1
? 6 28 2 32 4 36 26
? 2 1 26
? 7 28 2 32 4 36 26 27
? 6 28 2 32 4 36 27
? 2 1 27
? 7 28 2 32 4 36 26 33
? 6 28 2 32 36 26 33
? 5 2 32 36 26 33
? 3 1 27 33
? 7 28 2 32 4 36 26 24
? 6 28 2 32 36 26 24
? 4 1 27 33 2...

result:

ok correct

Test #9:

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

input:

25
-1 -1
-1 -1
7 20
-1 -1
-1 -1
-1 -1
20 13
13 8
-1 -1
7 13
10 17
-1 -1
7 17
-1 -1
10 21
8 21
-1 -1
-1 -1
13 21
-1 -1
10 11
-1 -1
21 11
-1 -1
-1 -1
-1 -1
7 19
-1 -1
13 19
19 11
-1 -1
24 15
10 15
-1 -1
-1 -1
-1 -1
20 3
10 3
-1 -1
7 3
-1 -1
-1 -1
5 8
-1 -1
5 7
5 21
5 13
-1 -1
20 22
-1 -1
22 21
-1 -1
1...

output:

? 2 8 20
? 3 8 20 10
? 4 8 20 10 7
? 3 8 10 7
? 4 8 20 10 24
? 2 7 24
? 5 8 20 10 24 13
? 4 8 10 24 13
? 3 10 24 13
? 2 7 13
? 5 8 20 10 24 17
? 4 8 20 24 17
? 2 7 17
? 2 13 17
? 5 8 20 10 24 21
? 4 8 20 24 21
? 3 20 24 21
? 2 7 21
? 3 13 17 21
? 2 17 21
? 5 8 20 10 24 11
? 4 8 20 24 11
? 3 7 21 11
...

result:

ok correct

Test #10:

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

input:

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

output:

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

result:

ok correct

Test #11:

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

input:

3
3 1
2 3
2 1

output:

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

result:

ok correct

Test #12:

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

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

input:

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

output:

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

result:

ok correct

Test #14:

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

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

input:

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

output:

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

result:

ok correct

Test #16:

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

input:

93
-1 -1
-1 -1
49 43
-1 -1
-1 -1
49 74
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 29
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
56 43
56 44
-1 -1
49 56
-1 -1
91 74
-1 -1
-1 -1
-1 -1
59 82
82 15
-1 -1
-1 -1
-1 -1
43 70
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
40 44
40 4...

output:

? 2 30 18
? 3 30 18 43
? 4 30 18 43 49
? 3 30 18 49
? 4 30 18 43 74
? 2 49 74
? 5 30 18 43 74 92
? 2 49 92
? 6 30 18 43 74 92 44
? 2 49 44
? 7 30 18 43 74 92 44 17
? 2 49 17
? 8 30 18 43 74 92 44 17 15
? 2 49 15
? 9 30 18 43 74 92 44 17 15 29
? 2 49 29
? 10 30 18 43 74 92 44 17 15 29 59
? 2 49 59
? ...

result:

ok correct

Test #17:

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

input:

111
-1 -1
-1 -1
41 58
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
16 58
-1 -1
-1 -1
72 5
-1 -1
-1 -1
75 5
75 41
-1 -1
-1 -1
-1 -1
57 72
-1 -1
88 56
56 41
-1 -1
-1 -1
41 62
-1 -1
-1 -1
88 2
-1 -1
2 56
-1 -1
16 111
-1 -1
56 111
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
22 102
-1 -1
-1 -1
-1 -1
83 57
83 ...

output:

? 2 41 5
? 3 41 5 88
? 4 41 5 88 58
? 3 5 88 58
? 4 41 5 88 45
? 2 58 45
? 5 41 5 88 45 82
? 2 58 82
? 6 41 5 88 45 82 16
? 2 58 16
? 7 41 5 88 45 82 16 95
? 2 58 95
? 8 41 5 88 45 82 16 95 72
? 7 41 88 45 82 16 95 72
? 2 58 72
? 8 41 5 88 45 82 16 95 75
? 7 41 88 45 82 16 95 75
? 6 88 45 82 16 95 7...

result:

ok correct

Test #18:

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

input:

132
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
83 40
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
40 12
28 126
-1 -1
-1 -1
-1 -1
-1 -1
116 37
121 116
-1 -1
-1 -1
121 53
-1 -1
-1 -1
118 64
-1 -1
-1 -1
16 35
-1 -1
-1 -1
121 110
102 110
-1 -1
53 110
116 110
-1 -1
102 85
-1 -1
-1 -1
-1 -1
98 115
-1 -1...

output:

? 2 80 16
? 3 80 16 37
? 4 80 16 37 126
? 5 80 16 37 126 83
? 6 80 16 37 126 83 118
? 7 80 16 37 126 83 118 40
? 6 80 16 37 126 118 40
? 7 80 16 37 126 83 118 124
? 2 40 124
? 8 80 16 37 126 83 118 124 121
? 2 40 121
? 9 80 16 37 126 83 118 124 121 102
? 2 40 102
? 10 80 16 37 126 83 118 124 121 102...

result:

ok correct

Test #19:

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

input:

94
-1 -1
-1 -1
-1 -1
-1 -1
71 80
-1 -1
71 37
32 37
-1 -1
-1 -1
-1 -1
-1 -1
87 22
-1 -1
-1 -1
-1 -1
-1 -1
52 68
3 68
87 68
-1 -1
-1 -1
71 36
-1 -1
-1 -1
-1 -1
80 28
-1 -1
-1 -1
-1 -1
32 72
52 72
72 71
-1 -1
72 80
-1 -1
32 61
-1 -1
-1 -1
72 61
-1 -1
-1 -1
-1 -1
32 79
-1 -1
61 79
79 80
-1 -1
-1 -1
-1 -...

output:

? 2 3 71
? 3 3 71 23
? 4 3 71 23 9
? 5 3 71 23 9 32
? 6 3 71 23 9 32 80
? 5 3 23 9 32 80
? 6 3 71 23 9 32 37
? 5 3 23 9 32 37
? 4 3 23 9 37
? 2 80 37
? 6 3 71 23 9 32 87
? 3 80 37 87
? 7 3 71 23 9 32 87 22
? 6 3 71 23 9 32 22
? 3 80 37 22
? 7 3 71 23 9 32 87 52
? 4 80 37 22 52
? 8 3 71 23 9 32 87 52...

result:

ok correct

Test #20:

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

input:

73
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
53 56
-1 -1
58 35
-1 -1
-1 -1
63 53
-1 -1
-1 -1
20 14
53 20
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
39 5
-1 -1
-1 -1
-1 -1
62 20
-1 -1
4 53
-1 -1
4 20
-1 -1
-1 -1
44 35
44 5
-1 -1
-1 -1
39 34
46 34
30 34
-1 -1
-1 -1
4 34
28 39
-1 -1
28...

output:

? 2 30 58
? 3 30 58 57
? 4 30 58 57 46
? 5 30 58 57 46 53
? 6 30 58 57 46 53 66
? 7 30 58 57 46 53 66 41
? 8 30 58 57 46 53 66 41 14
? 9 30 58 57 46 53 66 41 14 56
? 8 30 58 57 46 66 41 14 56
? 9 30 58 57 46 53 66 41 14 35
? 8 30 57 46 53 66 41 14 35
? 2 56 35
? 9 30 58 57 46 53 66 41 14 63
? 8 30 5...

result:

ok correct

Test #21:

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

input:

77
-1 -1
-1 -1
39 30
-1 -1
-1 -1
70 30
-1 -1
-1 -1
44 43
-1 -1
-1 -1
44 60
-1 -1
-1 -1
57 39
-1 -1
57 60
-1 -1
-1 -1
30 72
-1 -1
-1 -1
24 72
-1 -1
60 24
-1 -1
-1 -1
14 72
14 38
-1 -1
-1 -1
14 57
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
24 41
57 41
35 41
35 44
-1 -1
14 35
-1 -1
35 57
-1 -1
7 39
-1 -1
14 7...

output:

? 2 67 39
? 3 67 39 38
? 4 67 39 38 30
? 3 67 38 30
? 4 67 39 38 70
? 2 30 70
? 5 67 39 38 70 44
? 2 30 44
? 6 67 39 38 70 44 43
? 5 67 39 38 70 43
? 2 30 43
? 6 67 39 38 70 44 60
? 5 67 39 38 70 60
? 3 30 43 60
? 6 67 39 38 70 44 57
? 5 67 38 70 44 57
? 4 30 43 60 57
? 3 30 43 57
? 6 67 39 38 70 44...

result:

ok correct

Test #22:

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

input:

81
-1 -1
64 6
-1 -1
-1 -1
6 51
-1 -1
6 26
75 26
2 75
-1 -1
-1 -1
2 41
-1 -1
-1 -1
64 1
-1 -1
-1 -1
64 42
2 42
-1 -1
-1 -1
-1 -1
41 23
-1 -1
2 79
79 23
-1 -1
-1 -1
64 43
-1 -1
75 43
-1 -1
-1 -1
80 6
-1 -1
-1 -1
20 51
-1 -1
-1 -1
-1 -1
-1 -1
67 75
-1 -1
-1 -1
2 10
10 23
10 64
-1 -1
10 6
10 42
-1 -1
-1...

output:

? 2 64 2
? 3 64 2 6
? 2 2 6
? 3 64 2 51
? 2 6 51
? 4 64 2 51 26
? 2 6 26
? 5 64 2 51 26 75
? 4 64 2 51 75
? 3 64 51 75
? 2 6 75
? 5 64 2 51 26 41
? 4 64 51 26 41
? 3 6 75 41
? 5 64 2 51 26 1
? 4 2 51 26 1
? 4 6 75 41 1
? 5 64 2 51 26 42
? 4 2 51 26 42
? 3 51 26 42
? 5 6 75 41 1 42
? 5 64 2 51 26 23
...

result:

ok correct

Test #23:

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

input:

93
-1 -1
-1 -1
-1 -1
-1 -1
74 27
-1 -1
83 70
83 90
-1 -1
-1 -1
-1 -1
27 28
-1 -1
61 90
-1 -1
-1 -1
-1 -1
83 62
-1 -1
86 77
86 90
74 86
-1 -1
-1 -1
79 62
74 79
79 28
-1 -1
83 79
61 79
86 79
-1 -1
-1 -1
86 33
-1 -1
-1 -1
51 70
-1 -1
61 51
-1 -1
-1 -1
7 77
70 7
-1 -1
61 7
27 7
-1 -1
51 7
-1 -1
70 59
-1...

output:

? 2 74 90
? 3 74 90 76
? 4 74 90 76 77
? 5 74 90 76 77 70
? 6 74 90 76 77 70 27
? 5 90 76 77 70 27
? 6 74 90 76 77 70 83
? 5 74 90 76 77 83
? 4 74 76 77 83
? 2 27 83
? 6 74 90 76 77 70 28
? 3 27 83 28
? 2 83 28
? 7 74 90 76 77 70 28 61
? 6 74 76 77 70 28 61
? 3 27 83 61
? 7 74 90 76 77 70 28 62
? 4 ...

result:

ok correct

Test #24:

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

input:

37
-1 -1
-1 -1
-1 -1
3 25
33 25
-1 -1
12 8
33 8
9 8
-1 -1
25 8
36 3
36 12
-1 -1
36 25
-1 -1
12 7
-1 -1
-1 -1
7 8
-1 -1
9 34
12 34
33 34
-1 -1
25 34
7 34
8 34
36 34
33 30
-1 -1
30 25
-1 -1
30 8
36 30
-1 -1
33 16
9 16
-1 -1
25 16
-1 -1
16 8
-1 -1
30 16
-1 -1
3 26
12 26
9 26
33 26
7 26
25 26
26 8
-1 -1...

output:

? 2 12 33
? 3 12 33 9
? 4 12 33 9 3
? 5 12 33 9 3 25
? 4 12 33 9 25
? 3 12 9 25
? 5 12 33 9 3 8
? 4 33 9 3 8
? 3 9 3 8
? 2 3 8
? 2 25 8
? 5 12 33 9 3 36
? 4 12 33 9 36
? 3 33 9 36
? 2 25 36
? 2 8 36
? 5 12 33 9 3 7
? 4 33 9 3 7
? 2 25 7
? 3 8 36 7
? 2 36 7
? 5 12 33 9 3 34
? 4 12 33 3 34
? 3 33 3 34...

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
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
112 23
-1 -1
-1 -1
-1 -1
72 36
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1...

output:

? 2 8 33
? 3 8 33 67
? 4 8 33 67 131
? 5 8 33 67 131 142
? 6 8 33 67 131 142 122
? 7 8 33 67 131 142 122 127
? 8 8 33 67 131 142 122 127 17
? 9 8 33 67 131 142 122 127 17 34
? 10 8 33 67 131 142 122 127 17 34 68
? 11 8 33 67 131 142 122 127 17 34 68 91
? 12 8 33 67 131 142 122 127 17 34 68 91 137
? ...

result:

ok correct

Test #26:

score: 0
Accepted
time: 19ms
memory: 5752kb

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
440 6
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
250 437
-1 -1
-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 221 249
? 3 221 249 215
? 4 221 249 215 498
? 5 221 249 215 498 70
? 6 221 249 215 498 70 155
? 7 221 249 215 498 70 155 6
? 8 221 249 215 498 70 155 6 166
? 9 221 249 215 498 70 155 6 166 560
? 10 221 249 215 498 70 155 6 166 560 214
? 11 221 249 215 498 70 155 6 166 560 214 250
? 12 221 249 21...

result:

ok correct

Test #27:

score: 0
Accepted
time: 39ms
memory: 5764kb

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

output:

? 2 32 196
? 3 32 196 49
? 4 32 196 49 489
? 5 32 196 49 489 580
? 6 32 196 49 489 580 498
? 7 32 196 49 489 580 498 324
? 8 32 196 49 489 580 498 324 211
? 9 32 196 49 489 580 498 324 211 19
? 10 32 196 49 489 580 498 324 211 19 409
? 11 32 196 49 489 580 498 324 211 19 409 656
? 12 32 196 49 489 5...

result:

ok correct

Test #28:

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

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

output:

? 2 805 504
? 3 805 504 875
? 4 805 504 875 322
? 5 805 504 875 322 514
? 6 805 504 875 322 514 121
? 7 805 504 875 322 514 121 171
? 8 805 504 875 322 514 121 171 470
? 9 805 504 875 322 514 121 171 470 194
? 10 805 504 875 322 514 121 171 470 194 13
? 11 805 504 875 322 514 121 171 470 194 13 961
...

result:

ok correct

Test #29:

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

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

output:

? 2 760 653
? 3 760 653 256
? 4 760 653 256 302
? 5 760 653 256 302 588
? 6 760 653 256 302 588 755
? 7 760 653 256 302 588 755 205
? 8 760 653 256 302 588 755 205 230
? 9 760 653 256 302 588 755 205 230 399
? 10 760 653 256 302 588 755 205 230 399 412
? 11 760 653 256 302 588 755 205 230 399 412 80...

result:

ok correct

Test #30:

score: -100
Runtime Error

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
573 315
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-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 1256 271
? 3 1256 271 760
? 4 1256 271 760 1757
? 5 1256 271 760 1757 573
? 6 1256 271 760 1757 573 705
? 7 1256 271 760 1757 573 705 1831
? 8 1256 271 760 1757 573 705 1831 1093
? 9 1256 271 760 1757 573 705 1831 1093 836
? 10 1256 271 760 1757 573 705 1831 1093 836 1067
? 11 1256 271 760 1757 ...

result: