Submission #702797

#TimeUsernameProblemLanguageResultExecution timeMemory
702797HalogenCarnival (CEOI14_carnival)C++14
100 / 100
8 ms304 KiB
#include <bits/stdc++.h> using namespace std; vector<int> group[200]; int check(int x, int y, int test) { cout << y - x + 2 << ' ' << test << ' '; for (int i = x; i <= y; i++) { cout << group[i][0] << ' '; } cout << endl; int res; cin >> res; return res != y - x + 1; } int main() { int N; cin >> N; int cnt = 1; group[1].push_back(1); for (int i = 2; i <= N; ++i) { if (check(1, cnt, i)) { group[++cnt].push_back(i); continue; } int l = 1, r = cnt - 1; while(l <= r) { int m = l + r >> 1; if (check(l, m, i)) l = m + 1; else r = m - 1; } group[l].push_back(i); } int ans[200]; for (int i = 1; i <= cnt; i++) { for (int k : group[i]) ans[k] = i; } 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:35:23: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   35 |             int m = 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...