이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int NM = 150;
int N, a[NM+5], k, pos[NM+5];
int ask(int t, int i){
cout << t+1 << ' ';
for (int j = 1; j <= t; j++)
cout << pos[j] << ' ';
cout << i << endl;
int res;
cin >> res;
return res;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> N;
a[k = 1] = 1;
pos[1] = 1;
for (int i = 2; i <= N; i++){
int L = 1, R = k, j = -1;
while (L <= R){
int mid = (L+R)/2;
if (ask(mid, i) == mid){
j = mid;
R = mid-1;
}
else L = mid+1;
}
if (j == -1){
a[i] = ++k;
pos[k] = i;
}
else{
a[i] = j;
}
}
cout << 0 << ' ';
for (int i = 1; i <= N; i++)
cout << a[i] << ' ';
cout << endl;
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... |