This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int mxN = 157;
int ans[mxN];
vector<int> c[mxN];
int32_t main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n;
cin >> n;
int cur = 1;
ans[1] = cur;
c[cur].push_back(1);
for (int i = 2; i <= n; ++i) {
cout << cur + 1 << ' ';
for (int j = 1; j <= cur; ++j) {
cout << c[j].back() << ' ';
}
cout << i << endl;
int num;
cin >> num;
if (num == cur + 1) {
ans[i] = ++cur;
c[cur].push_back(i);
continue;
}
int l = 1, r = cur, res = 0;
while (l <= r) {
int mid = (l + r) / 2;
cout << mid + 1 << ' ';
for (int j = 1; j <= mid; ++j) {
cout << c[j].back() << ' ';
}
cout << i << endl;
cin >> num;
if (num == mid + 1) {
l = mid + 1;
}
else {
r = mid - 1;
res = mid;
}
}
ans[i] = res;
c[res].push_back(i);
}
cout << "0 ";
for (int i = 1; i <= n; ++i) {
cout << ans[i] << ' ';
}
cout << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |