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;
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... |