이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |