# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
29577 | PrOAhMeT | Carnival (CEOI14_carnival) | C++14 | 26 ms | 2020 KiB |
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>
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define LL long long
#define st first
#define nd second
#define endl '\n'
using namespace std;
const int MAXN=155;
int n,ans[MAXN],t;
int ask(vector<int> &v) {
cout<<v.size();
for(int i=0;i<v.size();++i)
cout<<" "<<v[i];
cout<<endl;
int ret;
cin>>ret;
return ret;
}
void solve(vector<int> &v,int num) {
if(num==1) {
++t;
for(int i=0;i<v.size();++i)
ans[v[i]]=t;
return;
}
vector<int> l,r;
for(int i=0;i<v.size();++i) {
l.pb(v[i]);
if(ask(l)>num/2) {
l.pop_back();
r.pb(v[i]);
}
}
solve(l,ask(l));
solve(r,ask(r));
}
int main() {
cin>>n;
vector<int> v;
for(int i=1;i<=n;++i) {
v.pb(i);
}
solve(v,ask(v));
cout<<"0";
for(int i=1;i<=n;++i)
cout<<" "<<ans[i];
cout<<endl;
return 0;
}
Compilation message (stderr)
# | 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... |