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;
#define int long long
const int N=155;
int n,ans[N],y,mn; map<int,int> mp;
vector <int> v,t; set <int> s;
int ask(vector <int> a){
cout<<(int)a.size()<<" ";
for (int i:a) cout<<i<<" "; cout<<endl;
int x; cin>>x; return x;
}
void solve(int l,int r,int x){
int md=(l+r)/2;
if (l==r){
ans[x]=l; return;
}
v.clear();
for (int i=l; i<=(l+r)/2; i++){
v.push_back(i);
}
int y=ask(v); v.push_back(x);
if (y==ask(v)){
solve(l,md,x);
}
else solve(md+1,r,x);
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin>>n; mn=n+1;
for (int i=1; i<=n; i++){
ans[i]=i;
if (!t.empty()) y=ask(t);
t.push_back(i);
if (i>1 && ask(t)==y) solve(1,i-1,i);
s.insert(ans[i]);
} cout<<"0 ";
y=1;
for (auto it:s){
mp[it]=y; y++;
}
for (int i=1; i<=n; i++) cout<<mp[ans[i]]<<" ";
}
Compilation message (stderr)
carnival.cpp: In function 'long long int ask(std::vector<long long int>)':
carnival.cpp:9:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
9 | for (int i:a) cout<<i<<" "; cout<<endl;
| ^~~
carnival.cpp:9:30: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
9 | for (int i:a) cout<<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... |