Submission #939429

#TimeUsernameProblemLanguageResultExecution timeMemory
939429JakobZorzCarnival (CEOI14_carnival)C++17
100 / 100
8 ms700 KiB
#include<iostream> #include<vector> #include<queue> #include<stack> #include<algorithm> #include<limits.h> #include<math.h> #include<map> #include<set> #include<unordered_map> #include<unordered_set> #include<iomanip> #include<cstring> typedef long long ll; typedef unsigned long long ull; typedef long double ld; using namespace std; int res[150]; int query(vector<int>vec){ cout<<vec.size()<<endl; for(int i:vec) cout<<i+1<<" "; cout<<endl; int r; cin>>r; return r; } void get(int c1,int c2,vector<int>p){ // assign people colors from [c1, c2) if(c1+1==c2){ for(int i:p) res[i]=c1; return; } int c=(c1+c2)/2; vector<int>p1,p2; for(int i:p){ p1.push_back(i); if(query(p1)>c-c1){ p1.pop_back(); p2.push_back(i); } } get(c1,c,p1); get(c,c2,p2); } void solve(){ int n,c; cin>>n; vector<int>all; for(int i=0;i<n;i++) all.push_back(i); c=query(all); get(1,c+1,all); cout<<0<<endl; for(int i=0;i<n;i++) cout<<res[i]<<" "; cout<<endl; } int main(){ //ios::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL); //freopen("/Users/jakob/cp_testing/test.txt","r",stdin);freopen("output.out","w",stdout); int t=1;//cin>>t; while(t--)solve(); return 0; } /* */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...