-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA_MAD_Interactive_Problem.cpp
More file actions
61 lines (50 loc) · 1.12 KB
/
A_MAD_Interactive_Problem.cpp
File metadata and controls
61 lines (50 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <bits/stdc++.h>
using namespace std;
int query(vector<int> &temp) {
cout << "? " << temp.size() << " ";
for(auto &ele : temp) cout << ele << " ";
cout << endl;
int num;
cin >> num;
return num;
}
void solve() {
int n;
cin >> n;
vector<int> arr(2*n + 1);
vector<int> temp;
vector<int> t2;
for(int i=1;i<=2*n;i++) {
temp.push_back(i);
int num = query(temp);
if(num != 0) {
arr[i] = num;
t2.push_back(i);
temp.pop_back();
}
}
for(int i=1;i<=2*n;i++) {
if(arr[i] == 0) {
t2.push_back(i);
int num = query(t2);
arr[i] = num;
t2.pop_back();
}
}
// for(auto i : temp) cout << i << " "; cout << endl;
// for(auto i : t2) cout << i << " "; cout << endl;
cout << "! ";
for(int i=1;i<=2*n;i++) cout << arr[i] << " ";
cout << endl;
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int _;
cin >> _;
while (_-->0) {
solve();
}
return 0;
}