이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int maxv = 160;
vector<int> capMap(maxv);
int capColors[maxv];
bool check(int l, int r, int target) {
cout << r - l + 2 << " ";
cout << target << " ";
for (int i = l; i <= r; i++) {
cout << capMap[i] << " ";
}
cout << endl;
int v;
cin >> v;
if (v > (r - l + 1)) {
return true;
}
else {
return false;
}
}
int binary_search(int st, int en, int target) {
int l = st;
int r = en;
while (l <= r) {
int mid = (l + r)/2;
if (! check(l, mid, target)) {
r = mid - 1;
}
else {
l = mid + 1;
}
}
return l;
}
int main() {
cin.tie(NULL);
int N;
cin >> N;
// int currColors[N];
int caps = 1;
capColors[1] = 1;
capMap[1] = 1;
for(int i= 2; i< N + 1; i++) {
cout << i << " " << i << " ";
for (int j = 1; j <= caps; j++) {
cout << capMap[j] << " ";
}
cout << endl;
int amt;
cin >> amt;
if (amt > caps) {
// need a new color
caps++;
capColors[i] = caps;
capMap[caps] = i;
}
else {
int id = binary_search(1, i - 1, i);
capColors[i] = capMap[id];
}
}
cout << "0 ";
for(int i= 1; i< N + 1; i++) {
cout << capColors[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... |