# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
67247 | 2018-08-13T17:31:47 Z | KLPP | Carnival (CEOI14_carnival) | C++14 | 67 ms | 432 KB |
#include<iostream> #include<stdio.h> #include<vector> #include<algorithm> using namespace std; int n; int pergunta(vector<int> a){cout<<a.size()<<" "; for(int i=0;i<a.size();i++)cout<<a[i]+1<<" "; cout<<endl; int x; cin>>x; //x=a.size(); return x; } vector<int> ans(int i, int j){ if(i==j){ vector<int>v; v.push_back(j); return v; } int mid=(i+j)/2; vector<int> v1=ans(i,mid); vector<int> v2=ans(mid+1,j); /*for(int x=0;x<v1.size();x++)cout<<v1[x]<<" "; cout<<"V1"<<endl; for(int x=0;x<v2.size();x++)cout<<v2[x]<<" "; cout<<"V2"<<endl;*/ vector<pair<int,int> >V; int cnt[n]; for(int x=0;x<n;x++)cnt[x]=-1; for(int person=0;person<v2.size();person++){ cnt[v2[person]]=person+mid+1; //cout<<v2[person]<<" "<<person+mid+1<<endl; } vector<int> responde; for(int x=0;x<v1.size();x++){ int cor=0; for(int bit=0;bit<9;bit++){vector<int> festa; for(int y=0;y<n;y++){ if((y>>bit)%2==0 && cnt[y]!=-1){ festa.push_back(cnt[y]); } } festa.push_back(x+i); int R=pergunta(festa); if(R==festa.size())cor+=(1<<bit); } //cout<<cor<<endl<<endl; if(cor<n){ responde.push_back(cor); }else responde.push_back(v1[x]); } for(int person=0;person<v2.size();person++){ responde.push_back(v2[person]); } /*for(int x=0;x<responde.size();x++)cout<<responde[x]<<" "; cout<<"R"<<endl;*/ return responde; } int main(){ cin>>n; vector<int> V=ans(0,n-1); //for(int i=0;i<V.size();i++)cout<<V[i]<<endl; vector<pair<int,int> > v; for(int i=0;i<V.size();i++){ v.push_back(pair<int,int>(V[i],i)); }sort(v.begin(),v.end()); int color=0; int arr[n]; for(int i=0;i<v.size();i++){ if(i==0 || v[i].first!=v[i-1].first){ color++; }arr[v[i].second]=color; } for(int i=0;i<n;i++)cout<<arr[i]<<" "; cout<<endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 58 ms | 376 KB | Same person came twice to the party. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 67 ms | 376 KB | Same person came twice to the party. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 27 ms | 376 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 28 ms | 432 KB | Same person came twice to the party. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 42 ms | 432 KB | Same person came twice to the party. |
2 | Halted | 0 ms | 0 KB | - |