Submission #257170

#TimeUsernameProblemLanguageResultExecution timeMemory
257170a_playerCarnival (CEOI14_carnival)C++14
100 / 100
9 ms384 KiB
#include <bits/stdc++.h> using namespace std; const int nax=150+5; int col[nax]; vector<int> dist; vector<int> sis; void ric(int l, int r, int val){ if(l==r){ col[val-1]=l+1; return; } int m=(r+l)/2; cout<<m-l+2<<" "; for(int i=l;i<=m;i++)cout<<dist[i]<<" "; cout<<val<<endl; int h; cin>>h; if(h==m-l+2)ric(m+1,r,val); else ric(l,m,val); } int main(){ int N; cin>>N; dist.push_back(1); for(int i=2;i<=N;i++){ dist.push_back(i); cout<<dist.size()<<" "; for(int x:dist)cout<<x<<" "; cout<<endl; int h; cin>>h; if(h!=dist.size())dist.pop_back(),sis.push_back(i); } for(int i=0;i<dist.size();i++)col[dist[i]-1]=i+1; for(int x:sis)ric(0,dist.size()-1,x); cout<<"0 "; for(int i=0;i<N;i++)cout<<col[i]<<" "; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:33:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(h!=dist.size())dist.pop_back(),sis.push_back(i);
            ~^~~~~~~~~~~~~
carnival.cpp:35:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<dist.size();i++)col[dist[i]-1]=i+1;
                 ~^~~~~~~~~~~~
#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...