Submission #203571

#TimeUsernameProblemLanguageResultExecution timeMemory
203571triplem5dsCarnival (CEOI14_carnival)C++14
100 / 100
13 ms504 KiB
#pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") #include "bits/stdc++.h" using namespace std; #define f(i,a,b) for(int i = a; i < b; i++) #define pb push_back #define F first #define S second const int N = 1e6+5; const int MOD = 1e9 + 7; int ask(vector<int> v){ cout<<v.size(); for(auto x:v)cout<<' '<<x; cout<<endl; int ret; cin >> ret; return ret; } int col[155]; int get(vector<int> v, int x){ int lo = 0, hi = v.size()-1; while(lo<hi){ int md = lo + (hi - lo + 1) / 2; vector<int> tmp({x}); f(j,0,md)tmp.pb(v[j]); if(ask(tmp)==tmp.size()) lo = md; else hi = md - 1; } return col[v[lo]]; } int32_t main(){ #ifdef ONLINE_JUDGE ios_base::sync_with_stdio(0); cin.tie(0); #endif // ONLINE_JUDGE int n; cin>>n; vector<int>v({1}); col[1]=1; int cur = 1; f(i,2,n+1){ v.pb(i); int x = ask(v); if(x!=v.size()){ v.pop_back(); col[i] = get(v,i); } else col[i] = ++cur; } cout << 0; f(i,1,n+1)cout << ' ' << col[i]; cout << endl; return 0; }

Compilation message (stderr)

carnival.cpp: In function 'int get(std::vector<int>, int)':
carnival.cpp:27:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(ask(tmp)==tmp.size())
        ~~~~~~~~^~~~~~~~~~~~
carnival.cpp: In function 'int32_t main()':
carnival.cpp:46:9: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(x!=v.size()){
        ~^~~~~~~~~~
carnival.cpp:7:19: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
 #define f(i,a,b)  for(int i = a; i < b; i++)
                   ^
carnival.cpp:53:3: note: in expansion of macro 'f'
   f(i,1,n+1)cout << ' ' << col[i]; cout << endl;
   ^
carnival.cpp:53:36: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   f(i,1,n+1)cout << ' ' << col[i]; cout << endl;
                                    ^~~~
#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...