# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
67239 | 2018-08-13T17:17:11 Z | KLPP | Carnival (CEOI14_carnival) | C++14 | 4 ms | 824 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]<<" "; cout<<endl; int x; cin>>x; 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); 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); } if(cor<=n){ responde.push_back(cor); }else responde.push_back(v1[i]); } for(int person=0;person<v2.size();person++){ responde.push_back(v2[i]); } 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 | Runtime error | 3 ms | 416 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 520 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 624 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 824 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 824 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |