| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1337725 | kawhiet | Xylophone (JOI18_xylophone) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
auto ask = [&](vector<int> k) {
cout << k.size();
for (auto i : k) {
cout << ' ' << i + 1;
}
cout << endl;
int ret;
cin >> ret;
return ret;
};
vector<int> ans(n, -1);
ans[0] = 1;
vector<int> pos = {0};
for (int i = 1; i < n; i++) {
pos.push_back(i);
if (ask(pos) == pos.size()) {
ans[i] = pos.size();
} else {
pos.pop_back();
int l = -1, r = pos.size() - 1;
while (l + 1 < r) {
int m = (l + r) / 2;
vector<int> s = {i};
for (int i = 0; i <= m; i++) {
s.push_back(pos[i]);
}
if (ask(s) == s.size()) {
l = m;
} else {
r = m;
}
}
ans[i] = ans[pos[r]];
}
}
cout << 0 << '\n';
for (int i = 0; i < n; i++) {
cout << ans[i] << ' ';
}
cout << '\n';
return 0;
}