QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#496887#4218. Hidden GraphhazeTL 67ms6000kbC++205.2kb2024-07-28 16:45:122024-07-28 16:45:12

Judging History

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

  • [2024-07-28 16:45:12]
  • 评测
  • 测评结果:TL
  • 用时:67ms
  • 内存:6000kb
  • [2024-07-28 16:45:12]
  • 提交

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(set<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<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: 5636kb

input:

3
2 3
1 2
1 3

output:

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

result:

ok correct

Test #2:

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

input:

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

output:

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

result:

ok correct

Test #3:

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

input:

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

output:

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

result:

ok correct

Test #4:

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

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

input:

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

output:

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

result:

ok correct

Test #6:

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

input:

27
-1 -1
-1 -1
-1 -1
19 16
1 19
2 19
-1 -1
10 16
-1 -1
-1 -1
6 16
6 1
-1 -1
6 19
-1 -1
2 26
-1 -1
19 26
-1 -1
-1 -1
-1 -1
24 10
24 19
6 24
-1 -1
-1 -1
-1 -1
-1 -1
1 9
9 20
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
3 1
3 2
-1 -1
3 19
-1 -1
-1 -1
24 8
1 8
-1 -1
10 8
-1 -1
6 8
-1 -1
24 13
-1 -1
10 13
19 13
-...

output:

? 2 1 20
? 3 1 20 2
? 4 1 20 2 16
? 5 1 20 2 16 19
? 4 1 20 2 19
? 3 20 2 19
? 2 20 19
? 5 1 20 2 16 10
? 4 1 20 2 10
? 2 19 10
? 5 1 20 2 16 6
? 4 1 20 2 6
? 3 20 2 6
? 3 19 10 6
? 2 10 6
? 5 1 20 2 16 26
? 4 1 20 16 26
? 3 19 10 26
? 2 10 26
? 2 6 26
? 5 1 20 2 16 24
? 3 19 10 24
? 2 19 24
? 3 6 2...

result:

ok correct

Test #7:

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

input:

47
-1 -1
-1 -1
-1 -1
-1 -1
33 32
-1 -1
-1 -1
6 32
38 30
-1 -1
-1 -1
-1 -1
34 32
-1 -1
13 18
18 30
18 34
-1 -1
18 32
-1 -1
45 34
-1 -1
45 32
-1 -1
-1 -1
19 33
-1 -1
-1 -1
19 18
-1 -1
-1 -1
-1 -1
-1 -1
21 35
21 34
-1 -1
21 38
19 21
-1 -1
21 45
-1 -1
13 11
11 35
-1 -1
-1 -1
18 11
-1 -1
21 11
13 15
-1 -...

output:

? 2 30 13
? 3 30 13 35
? 4 30 13 35 33
? 5 30 13 35 33 8
? 6 30 13 35 33 8 32
? 5 30 13 35 8 32
? 6 30 13 35 33 8 6
? 2 32 6
? 7 30 13 35 33 8 6 38
? 6 13 35 33 8 6 38
? 2 32 38
? 7 30 13 35 33 8 6 34
? 3 32 38 34
? 2 38 34
? 8 30 13 35 33 8 6 34 18
? 7 30 35 33 8 6 34 18
? 6 35 33 8 6 34 18
? 5 35 ...

result:

ok correct

Test #8:

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

input:

38
-1 -1
4 13
-1 -1
-1 -1
-1 -1
16 13
-1 -1
-1 -1
36 35
-1 -1
-1 -1
24 13
-1 -1
24 4
-1 -1
-1 -1
-1 -1
-1 -1
31 13
-1 -1
4 31
16 31
-1 -1
24 31
-1 -1
4 10
-1 -1
-1 -1
-1 -1
35 32
13 32
-1 -1
-1 -1
-1 -1
-1 -1
38 14
38 13
-1 -1
38 4
-1 -1
38 24
38 31
13 25
35 25
-1 -1
16 25
-1 -1
-1 -1
31 25
-1 -1
6 ...

output:

? 2 13 35
? 3 13 35 4
? 2 35 4
? 3 13 35 14
? 2 4 14
? 4 13 35 14 16
? 3 35 14 16
? 2 4 16
? 4 13 35 14 36
? 3 13 14 36
? 3 4 16 36
? 4 13 35 14 24
? 3 35 14 24
? 4 4 16 36 24
? 3 16 36 24
? 4 13 35 14 22
? 4 4 16 36 22
? 2 24 22
? 5 13 35 14 22 31
? 4 35 14 22 31
? 4 4 16 36 31
? 3 16 36 31
? 2 36 ...

result:

ok correct

Test #9:

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

input:

25
-1 -1
7 14
7 20
-1 -1
-1 -1
-1 -1
7 19
-1 -1
7 17
18 21
-1 -1
-1 -1
5 14
-1 -1
5 21
5 7
16 14
16 20
-1 -1
16 21
16 7
-1 -1
18 8
-1 -1
8 21
-1 -1
5 8
16 8
13 19
14 13
20 13
18 13
-1 -1
7 13
13 21
5 13
16 13
13 8
18 12
-1 -1
-1 -1
16 12
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
4 17
18 4
14 4...

output:

? 2 20 14
? 3 20 14 7
? 2 20 7
? 3 20 14 18
? 2 7 18
? 4 20 14 18 19
? 2 7 19
? 5 20 14 18 19 17
? 2 7 17
? 6 20 14 18 19 17 21
? 5 20 14 19 17 21
? 2 7 21
? 6 20 14 18 19 17 5
? 5 20 18 19 17 5
? 3 7 21 5
? 2 7 5
? 6 20 14 18 19 17 16
? 5 20 18 19 17 16
? 4 18 19 17 16
? 3 7 21 16
? 2 7 16
? 2 5 16...

result:

ok correct

Test #10:

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

input:

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

output:

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

result:

ok correct

Test #11:

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

input:

3
2 3
3 1
2 1

output:

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

result:

ok correct

Test #12:

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

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

input:

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

output:

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

result:

ok correct

Test #14:

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

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

input:

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

output:

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

result:

ok correct

Test #16:

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

input:

93
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 41
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
41 89
-1 -1
-1 -1
73 30
-1 -1
-1 -1
-1 -1
-1 -1
41 23
23 71
-1 -1
1 23
-1 -1
-1 -1
-1 -1
-1 -1
71 22
80 22
43 22
73 22
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
53 15
82 15
-1 -1
-1 -1
-1 -1
62 92
62 58
-1 -1
-1 -1...

output:

? 2 82 71
? 3 82 71 43
? 4 82 71 43 41
? 5 82 71 43 41 58
? 6 82 71 43 41 58 19
? 7 82 71 43 41 58 19 53
? 8 82 71 43 41 58 19 53 1
? 7 82 71 43 58 19 53 1
? 8 82 71 43 41 58 19 53 80
? 2 1 80
? 9 82 71 43 41 58 19 53 80 73
? 2 1 73
? 10 82 71 43 41 58 19 53 80 73 89
? 9 82 71 43 58 19 53 80 73 89
?...

result:

ok correct

Test #17:

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

input:

111
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
30 51
-1 -1
-1 -1
-1 -1
88 96
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
30 81
-1 -1
-1 -1
97 46
-1 -1
46 81
46 51
-1 -1
64 9
-1 -1
-1 -1
-1 -1
107 50
-1 -1
-1 -1
50 46
-1 -1
-1 -1
-1 -1
82 63
-1 -1
50 63
-1 -1
-1 -1
107 71
97 71
96 71
-1 -1
-1 -1
7...

output:

? 2 96 82
? 3 96 82 48
? 4 96 82 48 9
? 5 96 82 48 9 97
? 6 96 82 48 9 97 30
? 7 96 82 48 9 97 30 51
? 6 96 82 48 9 97 51
? 7 96 82 48 9 97 30 91
? 2 51 91
? 8 96 82 48 9 97 30 91 88
? 7 82 48 9 97 30 91 88
? 2 51 88
? 8 96 82 48 9 97 30 91 22
? 3 51 88 22
? 9 96 82 48 9 97 30 91 22 3
? 3 51 88 3
? ...

result:

ok correct

Test #18:

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

input:

132
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
110 73
73 50
-1 -1
98 132
-1 -1
-1 -1
95 100
-1 -1
-1 -1
-1 -1
-1 -1
106 110
-1 -1
-1 -1
38 7
-1 -1
-1 -1
-1 -1
106 61
7 61
-1 -1
38 10
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
26 14
-1 -1
132 14
-1 -1
79 30
-1 -1
95 30
-1 -1
-1 -1
-1 -1
55 95
55 ...

output:

? 2 98 9
? 3 98 9 100
? 4 98 9 100 50
? 5 98 9 100 50 71
? 6 98 9 100 50 71 110
? 7 98 9 100 50 71 110 26
? 8 98 9 100 50 71 110 26 38
? 9 98 9 100 50 71 110 26 38 90
? 10 98 9 100 50 71 110 26 38 90 79
? 11 98 9 100 50 71 110 26 38 90 79 73
? 10 98 9 100 50 71 26 38 90 79 73
? 9 98 9 100 71 26 38 9...

result:

ok correct

Test #19:

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

input:

94
-1 -1
-1 -1
44 19
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
6 70
70 37
70 44
-1 -1
-1 -1
78 44
6 78
-1 -1
70 78
-1 -1
-1 -1
17 70
-1 -1
-1 -1
90 37
-1 -1
-1 -1
-1 -1
10 37
17 10
-1 -1
70 10
-1 -1
-1 -1
57 37
-1 -1
70 57
57 90
57 19
57 78
-1 -1
37 7
-1 -1
-1 -1
-1 -1
-1 -1
42 44
-1 -1
42 90
42 70
-1 -1
-1 -1
...

output:

? 2 44 29
? 3 44 29 6
? 4 44 29 6 19
? 3 29 6 19
? 4 44 29 6 31
? 2 19 31
? 5 44 29 6 31 37
? 2 19 37
? 6 44 29 6 31 37 70
? 5 44 29 31 37 70
? 4 44 29 31 70
? 3 29 31 70
? 2 19 70
? 6 44 29 6 31 37 78
? 5 29 6 31 37 78
? 4 29 31 37 78
? 3 19 70 78
? 2 19 78
? 6 44 29 6 31 37 17
? 3 19 70 17
? 2 19 ...

result:

ok correct

Test #20:

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

input:

73
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
10 16
34 16
-1 -1
-1 -1
-1 -1
69 8
-1 -1
-1 -1
10 26
-1 -1
-1 -1
17 64
-1 -1
-1 -1
-1 -1
8 68
-1 -1
71 34
-1 -1
71 8
71 26
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
26 57
16 57
17 57
-1 -1
-1 -1
4 34
4 10
-1 -1
17 4
-1 -1
-1 -1
28 34
-1 -1
28 16
-1 -1
28 71
-1 -1
13 22
-1 -1
-1 ...

output:

? 2 10 34
? 3 10 34 64
? 4 10 34 64 41
? 5 10 34 64 41 22
? 6 10 34 64 41 22 69
? 7 10 34 64 41 22 69 16
? 6 34 64 41 22 69 16
? 5 64 41 22 69 16
? 7 10 34 64 41 22 69 56
? 2 16 56
? 8 10 34 64 41 22 69 56 8
? 7 10 34 64 41 22 56 8
? 2 16 8
? 8 10 34 64 41 22 69 56 26
? 7 34 64 41 22 69 56 26
? 3 16...

result:

ok correct

Test #21:

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

input:

77
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
32 65
-1 -1
-1 -1
-1 -1
22 36
36 30
-1 -1
-1 -1
50 15
-1 -1
-1 -1
50 2
-1 -1
2 15
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
2 14
21 22
21 5
14 21
50 21
-1 -1
15 21
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
30 45
-1 -1
-1 -1
21 45
-1 -1
-1 -1
-1 -1
-1 -1
37 30
37 5
-1...

output:

? 2 22 30
? 3 22 30 46
? 4 22 30 46 32
? 5 22 30 46 32 50
? 6 22 30 46 32 50 13
? 7 22 30 46 32 50 13 65
? 6 22 30 46 50 13 65
? 7 22 30 46 32 50 13 5
? 2 65 5
? 8 22 30 46 32 50 13 5 36
? 7 30 46 32 50 13 5 36
? 6 46 32 50 13 5 36
? 2 65 36
? 8 22 30 46 32 50 13 5 15
? 7 22 30 46 32 13 5 15
? 3 65 ...

result:

ok correct

Test #22:

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

input:

81
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
31 70
31 3
-1 -1
58 41
58 70
-1 -1
-1 -1
-1 -1
31 37
58 37
74 59
74 6
-1 -1
-1 -1
6 53
-1 -1
-1 -1
65 37
65 27
-1 -1
65 53
65 31
65 74
-1 -1
6 29
41 29
-1 -1
-1 -1
-1 -1
-1 -1
31 15
-1 -1
65 15
37 78
78 15
-1 -1
-1 -1
-1 -1
23 59
3 23
41 23
-1 -1
31 23
-1 -1
65...

output:

? 2 3 70
? 3 3 70 6
? 4 3 70 6 14
? 5 3 70 6 14 41
? 6 3 70 6 14 41 27
? 7 3 70 6 14 41 27 59
? 8 3 70 6 14 41 27 59 31
? 7 3 6 14 41 27 59 31
? 6 6 14 41 27 59 31
? 8 3 70 6 14 41 27 59 58
? 7 3 70 6 14 27 59 58
? 6 3 6 14 27 59 58
? 2 31 58
? 8 3 70 6 14 41 27 59 37
? 3 31 58 37
? 2 58 37
? 9 3 70...

result:

ok correct

Test #23:

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

input:

93
-1 -1
-1 -1
53 54
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
69 16
69 79
-1 -1
-1 -1
-1 -1
-1 -1
42 79
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
50 67
-1 -1
42 67
69 67
-1 -1
76 16
-1 -1
-1 -1
-1 -1
74 16
74 79
-1 -1
74 53
-1 -1
-1 -1
79 28
-1 -1
-1 -1
-1 -1
-1 -1
69 3
-1 -1
-1 -1
23 16
54 23
3 23
-1 -1...

output:

? 2 16 80
? 3 16 80 54
? 4 16 80 54 53
? 3 16 80 53
? 4 16 80 54 79
? 2 53 79
? 5 16 80 54 79 5
? 2 53 5
? 6 16 80 54 79 5 90
? 2 53 90
? 7 16 80 54 79 5 90 69
? 6 80 54 79 5 90 69
? 5 80 54 5 90 69
? 2 53 69
? 7 16 80 54 79 5 90 73
? 3 53 69 73
? 8 16 80 54 79 5 90 73 42
? 7 16 80 54 5 90 73 42
? 3...

result:

ok correct

Test #24:

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

input:

37
-1 -1
24 28
25 24
25 34
28 34
24 34
25 27
-1 -1
27 24
27 34
33 25
-1 -1
33 24
33 34
33 27
4 25
-1 -1
4 24
4 34
4 27
-1 -1
-1 -1
-1 -1
17 34
-1 -1
33 17
-1 -1
25 23
23 28
-1 -1
-1 -1
23 34
-1 -1
-1 -1
2 25
2 28
-1 -1
2 24
-1 -1
2 27
-1 -1
15 28
15 17
-1 -1
24 15
15 34
27 15
15 23
-1 -1
25 32
-1 -1...

output:

? 2 28 25
? 3 28 25 24
? 2 25 24
? 3 28 25 34
? 2 28 34
? 2 24 34
? 3 28 25 27
? 2 28 27
? 2 24 27
? 2 34 27
? 3 28 25 33
? 2 28 33
? 2 24 33
? 2 34 33
? 2 27 33
? 3 28 25 4
? 2 28 4
? 2 24 4
? 2 34 4
? 2 27 4
? 2 33 4
? 3 28 25 17
? 2 24 17
? 2 34 17
? 2 27 17
? 3 33 4 17
? 2 4 17
? 4 28 25 17 23
?...

result:

ok correct

Test #25:

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

input:

144
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
35 33
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
60 56
-1 -1
-1 -1
-1 -1
-1 -1
65 57
-1 -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 40 63
? 3 40 63 86
? 4 40 63 86 11
? 5 40 63 86 11 38
? 6 40 63 86 11 38 74
? 7 40 63 86 11 38 74 48
? 8 40 63 86 11 38 74 48 107
? 9 40 63 86 11 38 74 48 107 33
? 10 40 63 86 11 38 74 48 107 33 41
? 11 40 63 86 11 38 74 48 107 33 41 26
? 12 40 63 86 11 38 74 48 107 33 41 26 2
? 13 40 63 86 11 3...

result:

ok correct

Test #26:

score: 0
Accepted
time: 32ms
memory: 5936kb

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
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 -1
-1 -1
-1 -1
-1 -1
28 388
-1 -1
-1 -1
91 330
-1 -...

output:

? 2 520 59
? 3 520 59 206
? 4 520 59 206 560
? 5 520 59 206 560 239
? 6 520 59 206 560 239 388
? 7 520 59 206 560 239 388 516
? 8 520 59 206 560 239 388 516 22
? 9 520 59 206 560 239 388 516 22 336
? 10 520 59 206 560 239 388 516 22 336 196
? 11 520 59 206 560 239 388 516 22 336 196 466
? 12 520 59 ...

result:

ok correct

Test #27:

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

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
320 209
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-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 494 237
? 3 494 237 438
? 4 494 237 438 571
? 5 494 237 438 571 1
? 6 494 237 438 571 1 167
? 7 494 237 438 571 1 167 87
? 8 494 237 438 571 1 167 87 417
? 9 494 237 438 571 1 167 87 417 608
? 10 494 237 438 571 1 167 87 417 608 294
? 11 494 237 438 571 1 167 87 417 608 294 621
? 12 494 237 438 ...

result:

ok correct

Test #28:

score: 0
Accepted
time: 41ms
memory: 6000kb

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
582 634
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1...

output:

? 2 392 673
? 3 392 673 10
? 4 392 673 10 525
? 5 392 673 10 525 414
? 6 392 673 10 525 414 159
? 7 392 673 10 525 414 159 16
? 8 392 673 10 525 414 159 16 732
? 9 392 673 10 525 414 159 16 732 245
? 10 392 673 10 525 414 159 16 732 245 27
? 11 392 673 10 525 414 159 16 732 245 27 169
? 12 392 673 1...

result:

ok correct

Test #29:

score: 0
Accepted
time: 67ms
memory: 5988kb

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

output:

? 2 118 669
? 3 118 669 33
? 4 118 669 33 144
? 5 118 669 33 144 713
? 6 118 669 33 144 713 487
? 7 118 669 33 144 713 487 679
? 8 118 669 33 144 713 487 679 928
? 9 118 669 33 144 713 487 679 928 200
? 10 118 669 33 144 713 487 679 928 200 345
? 11 118 669 33 144 713 487 679 928 200 345 839
? 12 11...

result:

ok correct

Test #30:

score: -100
Time Limit Exceeded

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
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1536 246
-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 1689 1
? 3 1689 1 1491
? 4 1689 1 1491 1298
? 5 1689 1 1491 1298 1385
? 6 1689 1 1491 1298 1385 1359
? 7 1689 1 1491 1298 1385 1359 131
? 8 1689 1 1491 1298 1385 1359 131 632
? 9 1689 1 1491 1298 1385 1359 131 632 971
? 10 1689 1 1491 1298 1385 1359 131 632 971 914
? 11 1689 1 1491 1298 1385 135...

result: