Submission #777463

#TimeUsernameProblemLanguageResultExecution timeMemory
777463MetalPowerCarnival (CEOI14_carnival)C++14
0 / 100
6 ms208 KiB
#include <bits/stdc++.h> using namespace std; const int MX = 155; int N, ans[MX]; vector<int> df; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> N; ans[1] = 1; df.push_back(1); int tim = 2; for(int i = 2; i <= N; i++){ int l = 0, r = (int) df.size() - 1, memo = -1; for(; l <= r; ){ int mid = l + r >> 1; vector<int> nw; for(int j = l; j <= mid; j++) nw.push_back(df[j]); nw.push_back(i); cout << nw.size(); for(int x : nw) cout << " " << x; cout << endl; int num; cin >> num; if(num == (int) nw.size() - 1) memo = mid, r = mid - 1; else l = mid + 1; } if(memo == -1) ans[i] = tim++, df.push_back(i); else ans[i] = df[memo]; } cout << 0; for(int i = 1; i <= N; i++) cout << " " << ans[i]; cout << endl; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:24:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   24 |    int mid = l + r >> 1;
      |              ~~^~~
#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...