Submission #721422

#TimeUsernameProblemLanguageResultExecution timeMemory
721422FatihSolakCarnival (CEOI14_carnival)C++17
100 / 100
10 ms320 KiB
#include <bits/stdc++.h> #define N 200005 using namespace std; int ans[N]; void solve(){ int n; cin >> n; auto ask = [&](vector<int> v){ cout << v.size() << ' '; for(auto u:v){ cout << u << ' '; } cout << endl; int ret; cin >> ret; return ret; }; auto print = [&](){ cout << "0 "; for(int i = 1;i<=n;i++){ cout << ans[i] << ' '; } cout << endl; }; int cnt = 0; vector<int> v; for(int i = 1;i<=n;i++){ v.push_back(i); if(ask(v) == v.size()){ ans[i] = ++cnt; continue; } v.pop_back(); auto tmp = v; while(tmp.size() > 1){ vector<int> a; while(a.size() < tmp.size()){ a.push_back(tmp.back()); tmp.pop_back(); } a.push_back(i); if(ask(a) != a.size()){ a.pop_back(); tmp = a; } } ans[i] = ans[tmp[0]]; } print(); } int main(){ int t=1; //cin>>t; while(t--){ solve(); } #ifdef Local cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds "; #endif }

Compilation message (stderr)

carnival.cpp: In function 'void solve()':
carnival.cpp:29:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         if(ask(v) == v.size()){
      |            ~~~~~~~^~~~~~~~~~~
carnival.cpp:42:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |             if(ask(a) != a.size()){
      |                ~~~~~~~^~~~~~~~~~~
#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...