# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
995996 | vjudge1 | Carnival (CEOI14_carnival) | C++14 | 5 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;
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
vector<int> first;
int input;
first.push_back(1);
for(int i=2;i<=n;i++){
cout << first.size()+1 << ' ';
for(int j=0;j<first.size();j++){
cout << first[j] << ' ';
}
cout << i << endl;
cin >> input;
if(input==first.size()+1){
first.push_back(i);
}
}
int ans[n+1];
memset(ans,0,sizeof(ans));
for(int i=0;i<first.size();i++){
ans[first[i]]=i+1;
}
for(int i=1;i<=n;i++){
if(ans[i]!=0){
continue;
}
int low=1,high=first.size();
low--;
high++;
while(high-low>1){
int mid=(high-low)/2+low;
cout << mid+1 << ' ';
for(int j=0;j<mid;j++){
cout << first[j] << ' ';
}
cout << i << endl;
cin >> input;
if(input==mid+1){
low=mid;
}
else{
high=mid;
}
}
ans[i]=high;
}
cout << "0";
for(int i=1;i<=n;i++){
cout << ' ' << ans[i];
}
}
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... |