Submission #29577

#TimeUsernameProblemLanguageResultExecution timeMemory
29577PrOAhMeTCarnival (CEOI14_carnival)C++14
100 / 100
26 ms2020 KiB
#include <bits/stdc++.h> #define mp make_pair #define pb push_back #define pii pair<int,int> #define LL long long #define st first #define nd second #define endl '\n' using namespace std; const int MAXN=155; int n,ans[MAXN],t; int ask(vector<int> &v) { cout<<v.size(); for(int i=0;i<v.size();++i) cout<<" "<<v[i]; cout<<endl; int ret; cin>>ret; return ret; } void solve(vector<int> &v,int num) { if(num==1) { ++t; for(int i=0;i<v.size();++i) ans[v[i]]=t; return; } vector<int> l,r; for(int i=0;i<v.size();++i) { l.pb(v[i]); if(ask(l)>num/2) { l.pop_back(); r.pb(v[i]); } } solve(l,ask(l)); solve(r,ask(r)); } int main() { cin>>n; vector<int> v; for(int i=1;i<=n;++i) { v.pb(i); } solve(v,ask(v)); cout<<"0"; for(int i=1;i<=n;++i) cout<<" "<<ans[i]; cout<<endl; return 0; }

Compilation message (stderr)

carnival.cpp: In function 'int ask(std::vector<int>&)':
carnival.cpp:17:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<v.size();++i)
               ^
carnival.cpp: In function 'void solve(std::vector<int>&, int)':
carnival.cpp:30:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<v.size();++i)
                ^
carnival.cpp:35:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<v.size();++i) {
               ^
#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...