Submission #203562

#TimeUsernameProblemLanguageResultExecution timeMemory
203562triplem5dsCarnival (CEOI14_carnival)C++14
0 / 100
19 ms376 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; } vector<int> v; vector<int> notVisited; void solve(int s, int e){ if(s>e)return; int md = (s+e)>>1; f(i,s,e+1)v.pb(notVisited[i]); int x = ask(v); if(x!=1) f(i,s,e+1)v.pop_back(); if(s==e)return; solve(s,md); solve(md+1,e); } int32_t main(){ #ifdef ONLINE_JUDGE ios_base::sync_with_stdio(0); cin.tie(0); #endif // ONLINE_JUDGE int n; cin >> n; vector<bool>vis(n+1); map<int,int> mp; int cur = 0; while(mp.size()!=n){ v.clear(); notVisited.clear(); f(i,1,n+1)if(!vis[i])notVisited.pb(i); v.pb(notVisited[0]); vis[notVisited[0]] = 1; notVisited.erase(notVisited.begin()); solve(0,(int)notVisited.size()-1); cur++; for(auto k:v){ vis[k]=1; mp[k]=cur; } } cout<<0; f(i,1,n+1) cout << ' ' << mp[i]; cout << endl; return 0; }

Compilation message (stderr)

carnival.cpp: In function 'int32_t main()':
carnival.cpp:43:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while(mp.size()!=n){
         ~~~~~~~~~^~~
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:59:3: note: in expansion of macro 'f'
   f(i,1,n+1)  cout << ' ' << mp[i]; cout << endl;
   ^
carnival.cpp:59:37: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   f(i,1,n+1)  cout << ' ' << mp[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...