Submission #545251

#TimeUsernameProblemLanguageResultExecution timeMemory
545251JomnoiCarnival (CEOI14_carnival)C++17
100 / 100
9 ms320 KiB
#include <bits/stdc++.h> #define DEBUG 0 using namespace std; const int N = 160; int n, l, r, pos, mid, res, prv, now; int ans[N]; vector <int> vec; int main() { cin.tie(0)->sync_with_stdio(0); cin >> n; for(int i = 1; i <= n; i++) { cout << i << ' '; for(int j = 1; j <= i; j++) { cout << j << ' '; } cout << endl; cin >> now; if(now != prv) { vec.push_back(i); ans[i] = now; prv = now; continue; } l = 0, r = vec.size() - 1, pos; while(l <= r) { mid = (l + r) / 2; cout << mid + 2 << ' '; for(int i = 0; i <= mid; i++) { cout << vec[i] << ' '; } cout << i << endl; cin >> res; if(res < mid + 2) { r = mid - 1; pos = mid; } else { l = mid + 1; } } ans[i] = ans[vec[pos]]; } for(int i = 0; i <= n; i++) { cout << ans[i] << ' '; } cout << endl; return 0; }

Compilation message (stderr)

carnival.cpp: In function 'int main()':
carnival.cpp:29:39: warning: right operand of comma operator has no effect [-Wunused-value]
   29 |         l = 0, r = vec.size() - 1, pos;
      |                                       ^
#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...