# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
978172 | AlphaMale06 | Carnival (CEOI14_carnival) | C++17 | 4 ms | 600 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>
using namespace std;
#define pb push_back
int main()
{
int n;
cin >> n;
vector<int> qry;
qry.pb(1);
int c[n+1];
c[1]=1;
for(int i=2; i<=n; i++){
qry.pb(i);
cout << qry.size();
for(int e : qry)cout << " " << e;
cout << endl;
int ans;
cin >> ans;
if(ans==qry.size()){
c[i]=qry.size();
}
else{
qry.pop_back();
int sz = qry.size();
bool mark[sz];
for(int j=0; j< sz; j++)mark[j]=0;
int cnt=sz;
while(cnt>1){
int mk = cnt>>1;
vector<int> qry1;
vector<int> kolkogej;
for(int j=0; j<sz; j++){
if(!mark[j]){
mk--;
qry1.pb(qry[j]);
kolkogej.pb(j);
}
if(mk==0)break;
}
cout << qry1.size()+1;
for(int e : qry1)cout << " " << e;
cout << " " << i << endl;
int ans1;
cin >> ans1;
if(ans1==qry1.size()+1){
for(int e : kolkogej){
mark[e]=1;
}
}
else{
for(int j=0; j<sz; j++)mark[j]=1;
for(int e : kolkogej){
mark[e]=0;
}
}
cnt=0;
for(int j=0; j< sz; j++){
if(!mark[j])cnt++;
}
}
for(int j=0; j < sz; j++){
if(!mark[j]){
c[i]=c[qry[j]];
break;
}
}
}
}
cout << 0;
for(int i=1; i<=n; i++)cout << " " << c[i];
cout << endl;
}
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... |