| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1357028 | jump | A Difficult(y) Choice (BOI21_books) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
#define int long long
std::vector<int> type = {1};
int nType[100010];
int search(int l,int r,int i){
if(l==r)return l;
int mid=(l+r)/2;
for(int i=l;i<=mid;i++){
std::cout << type[i] << ' ';
}
std::cout << i << std::endl;
int res;
std::cin >> res;
if(res<=mid-l+1){
return search(l,mid,i);
}
else{
return search(mid+1,r,i);
}
}
signed main(){
nType[1]=1;
int n;std::cin >> n;
for(int i=2;i<=n;i++){
for(auto num:type){
std::cout << num << ' ';
}
std::cout << i << std::endl;
int res;
std::cin >> res;
if(res<=type.size()){
nType[i]=nType[type[search(0,type.size()-1,i)]];
}
else{
type.push_back(i);
nType[i]=type.size();
}
}
for(int i=1;i<=n;i++)std::cout << nType[i] << ' ';
std::cout << std::endl;
}
