QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#496880#4218. Hidden GraphhazeTL 60ms5864kbC++205.2kb2024-07-28 16:42:152024-07-28 16:42:16

Judging History

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

  • [2024-07-28 16:42:16]
  • 评测
  • 测评结果:TL
  • 用时:60ms
  • 内存:5864kb
  • [2024-07-28 16:42:15]
  • 提交

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

input:

3
1 2
1 3
2 3

output:

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

result:

ok correct

Test #2:

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

input:

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

output:

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

result:

ok correct

Test #3:

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

input:

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

output:

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

result:

ok correct

Test #4:

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

input:

3
-1 -1
1 3
2 1

output:

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

result:

ok correct

Test #5:

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

input:

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

output:

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

result:

ok correct

Test #6:

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

input:

27
6 13
-1 -1
-1 -1
10 13
-1 -1
-1 -1
12 11
-1 -1
6 11
-1 -1
-1 -1
6 16
10 16
-1 -1
24 13
-1 -1
24 10
6 24
-1 -1
8 13
-1 -1
6 8
10 8
24 8
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
21 2
-1 -1
-1 -1
21 24
-1 -1
21 8
-1 -1
-1 -1
4 11
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
9 20
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -...

output:

? 2 13 6
? 2 13 12
? 2 6 12
? 3 13 12 10
? 2 12 10
? 2 6 10
? 3 13 12 11
? 2 13 11
? 3 6 10 11
? 2 10 11
? 3 13 12 16
? 3 6 10 16
? 2 10 16
? 2 11 16
? 4 13 12 16 24
? 3 12 16 24
? 3 6 10 24
? 2 6 24
? 2 11 24
? 4 13 12 16 8
? 3 12 16 8
? 3 6 10 8
? 2 10 8
? 3 11 24 8
? 2 11 8
? 4 13 12 16 2
? 3 6 1...

result:

ok correct

Test #7:

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

input:

47
-1 -1
20 32
-1 -1
-1 -1
-1 -1
-1 -1
20 1
46 15
-1 -1
20 15
-1 -1
-1 -1
-1 -1
25 1
-1 -1
-1 -1
-1 -1
29 32
-1 -1
-1 -1
29 15
-1 -1
-1 -1
-1 -1
22 43
-1 -1
43 25
-1 -1
-1 -1
-1 -1
20 12
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
7 12
22 7
7 46
-1 -1
20 7
-1 -1
-1 -1
28 40
-1 -1
-1 -1
-1 -1
38 30
-1 -1
-1 -1
-1 ...

output:

? 2 32 46
? 3 32 46 20
? 2 46 20
? 3 32 46 22
? 2 20 22
? 4 32 46 22 1
? 2 20 1
? 5 32 46 22 1 15
? 4 32 22 1 15
? 2 20 15
? 5 32 46 22 1 37
? 2 20 37
? 2 15 37
? 6 32 46 22 1 37 25
? 5 32 46 22 37 25
? 2 20 25
? 2 15 25
? 6 32 46 22 1 37 29
? 5 46 22 1 37 29
? 3 20 25 29
? 2 15 29
? 6 32 46 22 1 37...

result:

ok correct

Test #8:

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

input:

38
4 5
4 6
-1 -1
-1 -1
3 5
-1 -1
4 33
-1 -1
33 6
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
4 31
-1 -1
31 6
31 5
31 33
-1 -1
16 6
-1 -1
-1 -1
16 31
16 25
2 25
35 25
-1 -1
-1 -1
-1 -1
31 25
16 20
4 20
20 35
-1 -1
6 20
-1 -1
-1 -1
-1 -1
24 4
-1 -1
24 6
-1 -1
24 33
-1 -1
24 31
28 3
-1 -1
-1 -1
28 33
-1 ...

output:

? 2 4 5
? 2 4 6
? 2 5 6
? 2 4 3
? 3 5 6 3
? 2 6 3
? 3 4 3 33
? 2 3 33
? 3 5 6 33
? 2 5 33
? 3 4 3 2
? 3 5 6 2
? 2 33 2
? 4 4 3 2 35
? 3 5 6 35
? 2 33 35
? 5 4 3 2 35 31
? 4 3 2 35 31
? 3 5 6 31
? 2 5 31
? 2 33 31
? 5 4 3 2 35 16
? 3 5 6 16
? 2 5 16
? 2 33 16
? 2 31 16
? 6 4 3 2 35 16 25
? 5 4 3 2 35...

result:

ok correct

Test #9:

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

input:

25
-1 -1
9 4
-1 -1
-1 -1
-1 -1
10 21
-1 -1
-1 -1
-1 -1
10 3
-1 -1
4 8
8 21
-1 -1
9 8
-1 -1
5 21
5 4
-1 -1
-1 -1
5 8
16 21
16 3
-1 -1
16 9
-1 -1
16 8
19 11
21 11
-1 -1
9 11
10 11
-1 -1
-1 -1
-1 -1
12 4
-1 -1
-1 -1
-1 -1
16 12
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
8 23
-1 -1
-1 -1
24 15
-1 -1
10 15
-1 -...

output:

? 2 19 4
? 3 19 4 9
? 2 19 9
? 3 19 4 21
? 2 9 21
? 4 19 4 21 10
? 3 19 4 10
? 2 9 10
? 4 19 4 21 3
? 3 9 10 3
? 2 9 3
? 5 19 4 21 3 8
? 4 19 21 3 8
? 3 19 3 8
? 3 9 10 8
? 2 10 8
? 5 19 4 21 3 5
? 4 19 4 3 5
? 3 19 3 5
? 3 9 10 5
? 2 8 5
? 5 19 4 21 3 16
? 4 19 4 3 16
? 3 19 4 16
? 4 9 10 5 16
? 3 ...

result:

ok correct

Test #10:

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

input:

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

output:

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

result:

ok correct

Test #11:

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

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

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

input:

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

output:

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

result:

ok correct

Test #14:

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

input:

3
-1 -1
2 1
-1 -1

output:

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

result:

ok correct

Test #15:

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

input:

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

output:

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

result:

ok correct

Test #16:

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

input:

93
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
88 43
-1 -1
-1 -1
-1 -1
82 13
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
88 73
-1 -1
-1 -1
3 29
-1 -1
-1 -1
52 84
-1 -1
84 29
-1 -1
-1 -1
-1 -1
-1 -1
56 3
-1 -1
56 13
56 43
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
3 90
-1 -1
-1 -1
-1 -1
34 9
-1 -1
9 90
9 29
-1 -1
-1 -1
-1 ...

output:

? 2 82 52
? 3 82 52 3
? 4 82 52 3 57
? 5 82 52 3 57 88
? 6 82 52 3 57 88 6
? 7 82 52 3 57 88 6 43
? 6 82 52 3 57 6 43
? 7 82 52 3 57 88 6 45
? 2 43 45
? 8 82 52 3 57 88 6 45 13
? 7 52 3 57 88 6 45 13
? 2 43 13
? 8 82 52 3 57 88 6 45 26
? 3 43 13 26
? 9 82 52 3 57 88 6 45 26 24
? 3 43 13 24
? 10 82 5...

result:

ok correct

Test #17:

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

input:

111
-1 -1
-1 -1
-1 -1
-1 -1
71 72
-1 -1
-1 -1
72 109
12 82
-1 -1
12 72
-1 -1
-1 -1
-1 -1
100 89
100 109
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
50 60
71 60
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
71 74
-1 -1
-1 -1
-1 -1
53 8
-1 -1
53 100
-1 -1
53 12
110 71
110 25
-1 -1
-1 -1
12 110
53 110
26 34
26 8
-1 -1
-...

output:

? 2 34 82
? 3 34 82 50
? 4 34 82 50 8
? 5 34 82 50 8 71
? 6 34 82 50 8 71 72
? 5 34 82 50 8 72
? 6 34 82 50 8 71 109
? 2 72 109
? 7 34 82 50 8 71 109 12
? 6 34 50 8 71 109 12
? 2 72 12
? 7 34 82 50 8 71 109 89
? 2 72 89
? 2 12 89
? 8 34 82 50 8 71 109 89 100
? 7 34 82 50 8 71 109 100
? 6 34 82 50 8 ...

result:

ok correct

Test #18:

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

input:

132
-1 -1
-1 -1
-1 -1
70 38
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
96 40
-1 -1
-1 -1
103 38
-1 -1
70 103
103 96
-1 -1
-1 -1
-1 -1
47 38
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
103 106
40 71
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
14 91
-1 -1
-1 -1
-1 -1
30 23
-1 -1
-1 -1
-1 -1
-1 -1
-1 ...

output:

? 2 23 48
? 3 23 48 38
? 4 23 48 38 50
? 5 23 48 38 50 70
? 4 23 48 50 70
? 5 23 48 38 50 40
? 2 70 40
? 6 23 48 38 50 40 3
? 2 70 3
? 7 23 48 38 50 40 3 96
? 6 23 48 38 50 3 96
? 2 70 96
? 7 23 48 38 50 40 3 103
? 6 23 48 50 40 3 103
? 3 70 96 103
? 2 96 103
? 7 23 48 38 50 40 3 27
? 3 70 96 27
? 2...

result:

ok correct

Test #19:

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

input:

94
-1 -1
-1 -1
70 78
-1 -1
-1 -1
-1 -1
75 22
-1 -1
-1 -1
-1 -1
70 41
-1 -1
42 35
-1 -1
42 70
-1 -1
19 22
-1 -1
-1 -1
-1 -1
-1 -1
17 70
-1 -1
-1 -1
31 41
31 85
-1 -1
-1 -1
-1 -1
57 85
57 78
-1 -1
57 19
70 57
-1 -1
-1 -1
41 12
-1 -1
75 12
19 12
-1 -1
-1 -1
11 22
17 11
-1 -1
-1 -1
-1 -1
-1 -1
70 46
-1 ...

output:

? 2 85 78
? 3 85 78 22
? 4 85 78 22 70
? 3 85 22 70
? 4 85 78 22 35
? 2 70 35
? 5 85 78 22 35 75
? 4 85 78 35 75
? 2 70 75
? 5 85 78 22 35 41
? 3 70 75 41
? 2 75 41
? 6 85 78 22 35 41 42
? 5 85 78 22 41 42
? 3 70 75 42
? 2 75 42
? 6 85 78 22 35 41 19
? 5 85 78 35 41 19
? 3 70 75 19
? 2 42 19
? 6 85 ...

result:

ok correct

Test #20:

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

input:

73
-1 -1
-1 -1
-1 -1
52 60
-1 -1
-1 -1
1 52
60 64
-1 -1
-1 -1
-1 -1
44 64
-1 -1
44 31
-1 -1
-1 -1
49 53
53 56
1 53
60 53
-1 -1
-1 -1
51 60
-1 -1
51 53
-1 -1
67 8
-1 -1
53 8
31 8
-1 -1
-1 -1
-1 -1
17 53
17 64
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
1 25
-1 -1
-1 -1
51 25
-1 -1
1 16
-1 -1
25 16
-1 -1
-1 -1
49 2...

output:

? 2 56 49
? 3 56 49 67
? 4 56 49 67 60
? 5 56 49 67 60 52
? 4 56 49 67 52
? 5 56 49 67 60 1
? 2 52 1
? 6 56 49 67 60 1 64
? 5 56 49 67 1 64
? 2 52 64
? 6 56 49 67 60 1 44
? 3 52 64 44
? 2 52 44
? 7 56 49 67 60 1 44 31
? 6 56 49 67 60 1 31
? 3 52 64 31
? 7 56 49 67 60 1 44 53
? 6 56 67 60 1 44 53
? 5...

result:

ok correct

Test #21:

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

input:

77
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
62 69
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
62 65
-1 -1
-1 -1
2 15
2 14
-1 -1
-1 -1
60 33
76 60
60 12
-1 -1
-1 -1
14 57
57 41
-1 -1
57 60
57 69
2 57
-1 -1
3 41
3 15
-1 -1
3 60
3 2
-1 -1
-1 -1
58 15
58 41
-1 -1
-1 -1
-1 -1
62 5
-1 -1
5 69
-1 -1
57 5
-1 -1
24 41
-1...

output:

? 2 71 12
? 3 71 12 41
? 4 71 12 41 62
? 5 71 12 41 62 76
? 6 71 12 41 62 76 10
? 7 71 12 41 62 76 10 48
? 8 71 12 41 62 76 10 48 33
? 9 71 12 41 62 76 10 48 33 69
? 8 71 12 41 76 10 48 33 69
? 9 71 12 41 62 76 10 48 33 14
? 2 69 14
? 10 71 12 41 62 76 10 48 33 14 15
? 2 69 15
? 11 71 12 41 62 76 10...

result:

ok correct

Test #22:

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

input:

81
2 60
-1 -1
-1 -1
-1 -1
60 18
10 18
2 10
-1 -1
10 60
2 62
-1 -1
60 62
10 62
2 27
-1 -1
-1 -1
-1 -1
62 27
-1 -1
-1 -1
-1 -1
62 15
2 50
-1 -1
50 27
-1 -1
50 10
50 62
80 6
18 6
-1 -1
60 6
-1 -1
10 6
62 6
50 6
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
75 16
18 75
2 75
-1 -1
-1 -1
-1 -1
-1 -1
50 75
-1 -1
18 ...

output:

? 2 2 60
? 2 2 80
? 2 60 80
? 3 2 80 18
? 2 60 18
? 4 2 80 18 10
? 3 2 80 10
? 2 80 10
? 2 60 10
? 4 2 80 18 62
? 3 80 18 62
? 2 60 62
? 2 10 62
? 4 2 80 18 27
? 3 80 18 27
? 2 60 27
? 2 10 27
? 2 62 27
? 4 2 80 18 15
? 3 60 27 15
? 2 10 15
? 2 62 15
? 5 2 80 18 15 50
? 4 80 18 15 50
? 3 60 27 50
? ...

result:

ok correct

Test #23:

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

input:

93
-1 -1
29 63
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
77 84
-1 -1
-1 -1
27 10
-1 -1
27 63
-1 -1
-1 -1
84 50
-1 -1
-1 -1
43 50
-1 -1
43 63
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
43 44
-1 -1
-1 -1
-1 -1
-1 -1
29 56
-1 -1
-1 -1
-1 -1
-1 -1
1 56
-1 -1
43 1
-1 -1
13 30
-1 -1
-1 -1
-1 -1...

output:

? 2 29 77
? 3 29 77 63
? 2 77 63
? 3 29 77 22
? 2 63 22
? 4 29 77 22 10
? 2 63 10
? 5 29 77 22 10 75
? 2 63 75
? 6 29 77 22 10 75 48
? 2 63 48
? 7 29 77 22 10 75 48 84
? 6 29 22 10 75 48 84
? 2 63 84
? 7 29 77 22 10 75 48 27
? 6 29 77 22 75 48 27
? 3 63 84 27
? 2 84 27
? 7 29 77 22 10 75 48 50
? 3 6...

result:

ok correct

Test #24:

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

input:

37
3 25
-1 -1
30 25
36 3
36 30
36 25
3 17
30 17
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
3 27
30 27
-1 -1
25 27
-1 -1
36 27
3 19
-1 -1
-1 -1
36 19
-1 -1
30 20
3 20
-1 -1
25 20
-1 -1
36 20
27 20
30 1
3 1
1 31
1 17
-1 -1
36 1
-1 -1
20 1
3 24
30 24
-1 -1
25 24
-1 -1
36 24
24 1
27 24
24 20
-1 -1
-1 -1
36 12
12 1
-...

output:

? 2 3 25
? 2 3 30
? 2 25 30
? 3 3 30 36
? 2 30 36
? 2 25 36
? 3 3 30 17
? 2 30 17
? 2 25 17
? 2 36 17
? 3 3 30 31
? 3 25 17 31
? 2 36 31
? 4 3 30 31 27
? 3 30 31 27
? 2 31 27
? 3 25 17 27
? 2 17 27
? 2 36 27
? 4 3 30 31 19
? 3 30 31 19
? 3 25 17 19
? 2 36 19
? 2 27 19
? 4 3 30 31 20
? 3 3 31 20
? 2 ...

result:

ok correct

Test #25:

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

input:

144
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
102 28
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
108 42
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-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 13 108
? 3 13 108 83
? 4 13 108 83 113
? 5 13 108 83 113 28
? 6 13 108 83 113 28 23
? 7 13 108 83 113 28 23 68
? 8 13 108 83 113 28 23 68 16
? 9 13 108 83 113 28 23 68 16 130
? 10 13 108 83 113 28 23 68 16 130 80
? 11 13 108 83 113 28 23 68 16 130 80 102
? 10 13 108 83 113 23 68 16 130 80 102
? ...

result:

ok correct

Test #26:

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

input:

561
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
366 448
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
435 366
-1 -1
-1 -1
-1 -1
494 448
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
366 336
-1 -1
-1 -1
-1 -1
-1 -1
151 77
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1...

output:

? 2 428 382
? 3 428 382 72
? 4 428 382 72 77
? 5 428 382 72 77 316
? 6 428 382 72 77 316 542
? 7 428 382 72 77 316 542 255
? 8 428 382 72 77 316 542 255 310
? 9 428 382 72 77 316 542 255 310 366
? 10 428 382 72 77 316 542 255 310 366 462
? 11 428 382 72 77 316 542 255 310 366 462 448
? 10 428 382 72...

result:

ok correct

Test #27:

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

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
213 370
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
85 175
-1 -1
-1 -1
-1 -1
-1 -1
175 327
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
47 438
47 241
-1 -1
-...

output:

? 2 568 402
? 3 568 402 370
? 4 568 402 370 145
? 5 568 402 370 145 87
? 6 568 402 370 145 87 350
? 7 568 402 370 145 87 350 562
? 8 568 402 370 145 87 350 562 125
? 9 568 402 370 145 87 350 562 125 571
? 10 568 402 370 145 87 350 562 125 571 175
? 11 568 402 370 145 87 350 562 125 571 175 362
? 12 ...

result:

ok correct

Test #28:

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

input:

1000
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
580 198
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
124 918
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 ...

output:

? 2 568 293
? 3 568 293 1
? 4 568 293 1 876
? 5 568 293 1 876 5
? 6 568 293 1 876 5 959
? 7 568 293 1 876 5 959 321
? 8 568 293 1 876 5 959 321 680
? 9 568 293 1 876 5 959 321 680 918
? 10 568 293 1 876 5 959 321 680 918 580
? 11 568 293 1 876 5 959 321 680 918 580 836
? 12 568 293 1 876 5 959 321 6...

result:

ok correct

Test #29:

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

input:

1000
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
109 110
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
876 76
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -1
-1 -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 876 329
? 3 876 329 853
? 4 876 329 853 86
? 5 876 329 853 86 533
? 6 876 329 853 86 533 150
? 7 876 329 853 86 533 150 110
? 8 876 329 853 86 533 150 110 422
? 9 876 329 853 86 533 150 110 422 145
? 10 876 329 853 86 533 150 110 422 145 79
? 11 876 329 853 86 533 150 110 422 145 79 183
? 12 876...

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
-1 -1
-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 244 1159
? 3 244 1159 1323
? 4 244 1159 1323 752
? 5 244 1159 1323 752 1403
? 6 244 1159 1323 752 1403 151
? 7 244 1159 1323 752 1403 151 1442
? 8 244 1159 1323 752 1403 151 1442 1452
? 9 244 1159 1323 752 1403 151 1442 1452 1604
? 10 244 1159 1323 752 1403 151 1442 1452 1604 1532
? 11 244 1159 ...

result: