Submission #203561

#TimeUsernameProblemLanguageResultExecution timeMemory
203561triplem5dsCarnival (CEOI14_carnival)C++14
20 / 100
97 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; } 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){ vector<int> v; f(i,1,n+1) if(!vis[i]){ if(v.empty())v.pb(i); else { v.pb(i); int x = ask(v); if(x!=1)v.pop_back(); } } 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:30: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:49:3: note: in expansion of macro 'f'
   f(i,1,n+1)  cout << ' ' << mp[i]; cout << endl;
   ^
carnival.cpp:49: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...