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);
int N, C = 0; cin >> N;
vector<int> costume(N + 1, -1);
for(int i = 1; i <= N; i++) {
if(costume[i] == -1) {
C++;
costume[i] = C;
}
int l = i + 1, r = N, mid, pos = N + 1;
while(l <= r) {
mid = (l + r) / 2;
cout << (mid - i + 1);
for(int j = i; j <= mid; j++) {
cout << ' ' << j;
}
cout << '\n';
cout.flush();
int a; cin >> a;
cout << (mid - i);
for(int j = i + 1; j <= mid; j++) {
cout << ' ' << j;
}
cout << '\n';
cout.flush();
int b; cin >> b;
if(a == b) {
pos = min(pos, mid);
r = mid - 1;
} else {
l = mid + 1;
}
}
if(pos != N + 1) {
costume[pos] = costume[i];
}
}
cout << 0;
for(int i = 1; i <= N; i++) {
cout << ' ' << costume[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... |