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;
using ll = long long;
int ans[155];
int main(){
//ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int n,x=1; cin >> n;
vector<int> v;
ans[1]=1;
v.push_back(1);
for(int i=2;i<=n;++i) {
int l=1,r=int(v.size()),best=0;
while(l<=r) {
int mid=(l+r)/2;
cout << mid + 1 << ' ' << i << ' ';
for(int j=0;j<mid;++j) {
cout << v[j] << ' ';
}
cout << '\n';
fflush(stdout);
int cur; cin >> cur;
if(cur==mid+1) {
best=mid;
l=mid+1;
} else {
r=mid-1;
}
}
if(best==int(v.size())) {
v.push_back(i);
ans[i]=++x;
} else {
ans[i]=ans[v[best]];
}
}
cout << "0 ";
for(int i=1;i<=n;++i) {
cout << ans[i] << ' ';
}
return 0;
}
// 1 2 3 2 2 4 1 5 6 5
# | 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... |