# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
203571 | triplem5ds | Carnival (CEOI14_carnival) | C++14 | 13 ms | 504 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.
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include "bits/stdc++.h"
using namespace std;
#define f(i,a,b) for(int i = a; i < b; i++)
#define pb push_back
#define F first
#define S second
const int N = 1e6+5;
const int MOD = 1e9 + 7;
int ask(vector<int> v){
cout<<v.size();
for(auto x:v)cout<<' '<<x;
cout<<endl;
int ret; cin >> ret; return ret;
}
int col[155];
int get(vector<int> v, int x){
int lo = 0, hi = v.size()-1;
while(lo<hi){
int md = lo + (hi - lo + 1) / 2;
vector<int> tmp({x});
f(j,0,md)tmp.pb(v[j]);
if(ask(tmp)==tmp.size())
lo = md;
else
hi = md - 1;
}
return col[v[lo]];
}
int32_t main(){
#ifdef ONLINE_JUDGE
ios_base::sync_with_stdio(0); cin.tie(0);
#endif // ONLINE_JUDGE
int n; cin>>n;
vector<int>v({1});
col[1]=1;
int cur = 1;
f(i,2,n+1){
v.pb(i);
int x = ask(v);
if(x!=v.size()){
v.pop_back();
col[i] = get(v,i);
} else
col[i] = ++cur;
}
cout << 0;
f(i,1,n+1)cout << ' ' << col[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... |