Submission #29574

#TimeUsernameProblemLanguageResultExecution timeMemory
29574PrOAhMeTCarnival (CEOI14_carnival)C++14
0 / 100
0 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) { printf("%d",(int)v.size()); for(int i=0;i<v.size();++i) printf(" %d",v[i]); fflush(stdout); int ret; scanf("%d",&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() { scanf("%d",&n); vector<int> v; for(int i=1;i<=n;++i) { v.pb(i); } solve(v,ask(v)); printf("0"); for(int i=1;i<=n;++i) printf(" %d",ans[i]); fflush(stdout); }

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) {
               ^
carnival.cpp: In function 'int ask(std::vector<int>&)':
carnival.cpp:21:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&ret);
                  ^
carnival.cpp: In function 'int main()':
carnival.cpp:49:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
                ^
#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...