Submission #209882

#TimeUsernameProblemLanguageResultExecution timeMemory
209882thebesCarnival (CEOI14_carnival)C++14
100 / 100
16 ms504 KiB
#include <bits/stdc++.h> #define DEBUG 1 using namespace std; namespace output{ void __(short x){cout<<x;} void __(unsigned x){cout<<x;} void __(int x){cout<<x;} void __(long long x){cout<<x;} void __(unsigned long long x){cout<<x;} void __(double x){cout<<x;} void __(long double x){cout<<x;} void __(char x){cout<<x;} void __(const char*x){cout<<x;} void __(const string&x){cout<<x;} void __(bool x){cout<<(x?"true":"false");} template<class S,class T> void __(const pair<S,T>&x){__(DEBUG?"(":""),__(x.first),__(DEBUG?", ":" "),__(x.second),__(DEBUG?")":"");} template<class T> void __(const vector<T>&x){__(DEBUG?"{":"");bool _=0;for(const auto&v:x)__(_?DEBUG?", ":" ":""),__(v),_=1;__(DEBUG?"}":"");} template<class T> void __(const set<T>&x){__(DEBUG?"{":"");bool _=0;for(const auto&v:x)__(_?DEBUG?", ":" ":""),__(v),_=1;__(DEBUG?"}":"");} template<class T> void __(const multiset<T>&x){__(DEBUG?"{":"");bool _=0;for(const auto&v:x)__(_?DEBUG?", ":" ":""),__(v),_=1;__(DEBUG?"}":"");} template<class S,class T> void __(const map<S,T>&x){__(DEBUG?"{":"");bool _=0;for(const auto&v:x)__(_?DEBUG?", ":" ":""),__(v),_=1;__(DEBUG?"}":"");} void pr(){cout<<"\n";} template<class S,class... T> void pr(const S&a,const T&...b){__(a);if(sizeof...(b))__(' ');pr(b...);} } using namespace output; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef pair<int,char> pic; typedef pair<double,double> pdd; typedef pair<ld,ld> pld; typedef vector<int> vi; typedef vector<ll> vl; #define pb push_back #define fox(i,x,y) for(int i=(x);i<=(y);i++) #define foxr(i,x,y) for(int i=(y);i>=(x);i--) const int MN = 155; int N, i, j, lo, hi, ans[MN]; vi arr, acc; int qu(){ printf("%d ",acc.size()); for(auto v : acc) printf("%d ",v); printf("\n"); fflush(stdout); int res; scanf("%d",&res); return res; } int main(){ scanf("%d",&N); for(i=1;i<=N;i++){ lo = 0, hi = arr.size(); while(lo<hi){ int m = (lo+hi)/2; acc.clear(); for(j=lo;j<=m;j++) acc.pb(arr[j]); acc.pb(i); if(qu()==acc.size()) lo=m+1; else hi=m; } ans[i] = lo; if(lo==arr.size()) arr.pb(i); } printf("0 "); for(i=1;i<=N;i++) printf("%d ",ans[i]+1); printf("\n"); return 0; }

Compilation message (stderr)

carnival.cpp: In function 'int qu()':
carnival.cpp:53:28: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type {aka long unsigned int}' [-Wformat=]
     printf("%d ",acc.size());
                  ~~~~~~~~~~^
carnival.cpp: In function 'int main()':
carnival.cpp:72:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if(qu()==acc.size()) lo=m+1;
                ~~~~^~~~~~~~~~~~
carnival.cpp:76:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(lo==arr.size()) arr.pb(i);
            ~~^~~~~~~~~~~~
carnival.cpp: In function 'int qu()':
carnival.cpp:58:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int res; scanf("%d",&res);
              ~~~~~^~~~~~~~~~~
carnival.cpp: In function 'int main()':
carnival.cpp:63:10: 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...