# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
842415 | vxxwu | Carnival (CEOI14_carnival) | C++17 | 6 ms | 952 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 <iostream>
#include <vector>
#include <algorithm>
#include <tuple>
using namespace std;
#define MAXN 150
#define ll long long
#define int ll
#define max max<int>
#define min min<int>
#define f first
#define s second
typedef pair<int, int> pii;
int costume[MAXN+1];
int costume_pointer[MAXN+1];
int costumes=1;
int diff;
void binary_search(vector<int> query, int index){
vector<int> temp;
for(int i=0; i<query.size()/2; i++){
temp.emplace_back(query[i]);
}
cout<<temp.size()+1<<" ";
for(int j:temp){
cout<<j<<" ";
}
cout<<index<<endl;
cin>>diff;
if(diff==temp.size()){
if(diff==1){
costume[index]=costume[temp[0]];
return;
}
binary_search(temp, index);
return;
}
temp.clear();
for(int i=query.size()/2; i<query.size(); i++){
temp.emplace_back(query[i]);
}
cout<<temp.size()+1<<" ";
for(int j:temp){
cout<<j<<" ";
}
cout<<index<<endl;
cin>>diff;
if(diff==temp.size()){
if(diff==1){
costume[index]=costume[temp[0]];
return;
}
binary_search(temp, index);
return;
}
}
int32_t main() {
// freopen("split.in", "r", stdin);
// freopen("split.out", "w", stdout);
int n; cin>>n;
costume[1]=1;
costume_pointer[1]=1;
for(int i=2; i<=n; i++) {
vector<int> query;
for(int j=1; j<=costumes; j++){
query.emplace_back(costume_pointer[j]);
}
cout<<costumes+1<<" ";
for(int j:query){
cout<<j<<" ";
}
cout<<i<<endl;
cin>>diff;
if(diff==costumes+1){
costumes++;
costume[i]=costumes;
costume_pointer[costumes]=i;
continue;
}
else{
binary_search(query, i);
}
}
cout<<0<<" ";
for(int i=1; i<=n; i++){
cout<<costume[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... |