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;
constexpr int N = 256;
int val[N];
vector<int> has;
int query(int l, int r, int i) {
cout << r-l+2;
for (int j = l; j <= r; ++j) {
cout << ' ' << has[j-1];
}
cout << ' ' << i << '\n';
int c; cin >> c; return c;
}
int main() {
int n; cin >> n;
val[1] = 1;
has.push_back(1);
for (int i = 2; i <= n; ++i) {
int k = has.size();
int l = 1, r = k;
if (query(l,r,i) > r-l+1) {
val[i] = k+1;
has.push_back(i);
continue;
}
while (l < r) {
int m = l + (r-l)/2;
if (query(l,m,i) == m-l+1) r = m;
else l = m+1;
}
val[i] = l;
}
cout << '0';
for (int i = 1; i <= n; ++i) {
cout << ' ' << val[i];
}
cout << '\n';
}
# | 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... |