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;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
auto Ask = [&](int low, int high) {
cout << high - low + 1 << " ";
for (int i = low; i <= high; i++) {
cout << i + 1 << " \n"[i == high];
}
cout.flush();
int ret;
cin >> ret;
return ret;
};
int cnt = 1;
int n;
cin >> n;
vector<int> color(n);
for (int i = 0; i < n; i++) {
int low = 0, high = i - 1;
while (low <= high) {
int mid = low + (high - low) / 2;
if (Ask(mid, i - 1) + 1 == Ask(mid, i)) {
high = mid - 1;
} else {
low = mid + 1;
}
}
int pos = low - 1;
if (pos < 0) {
color[i] = cnt++;
} else {
color[i] = color[pos];
}
}
cout << 0 << " ";
for (int i = 0; i < n; i++) {
cout << color[i] << " \n"[i == n - 1];
}
cout.flush();
return 0;
}
# | 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... |