-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathABC313_D.cpp
46 lines (45 loc) · 872 Bytes
/
ABC313_D.cpp
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
#include <bits/extc++.h>
using namespace std;
namespace pbds = __gnu_pbds;
using ui = unsigned int;
class dsds {
struct node {
size_t fa;
bool nav;
};
vector<node> v;
node find(size_t x) {
if (v[x].fa == x)
return v[x];
else {
node res = find(v[x].fa);
if (v[x].nav) res.nav ^= 1;
return res;
}
}
public:
void merge(size_t x, size_t y) {}
};
int main(void) {
ios::sync_with_stdio(false);
size_t n, k;
cin >> n >> k;
vector<bool> ans(n);
if (k == 1) {
for (size_t i = 0; i < n; i++) {
cout << "? " << i + 1 << endl;
bool x;
cin >> x;
ans[i] = x;
}
for (vector<bool>::reference i : ans) cout << i << ' ';
} else {
ans[0] = 1;
cout << "? ";
for (size_t i = 0; i < k; i++) cout << i << ' ';
cout << endl;
bool ans1;
cin >> ans1;
}
return 0;
}