Submission #698903

#TimeUsernameProblemLanguageResultExecution timeMemory
698903taherCarnival (CEOI14_carnival)C++17
100 / 100
24 ms312 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); auto Ask = [&](int low, int high) { cout << high - low + 1 << " "; for (int i = low; i <= high; i++) { cout << i + 1 << " \n"[i == high]; } cout.flush(); int ret; cin >> ret; return ret; }; int cnt = 1; int n; cin >> n; vector<int> color(n); for (int i = 0; i < n; i++) { int low = 0, high = i - 1; while (low <= high) { int mid = low + (high - low) / 2; if (Ask(mid, i - 1) + 1 == Ask(mid, i)) { high = mid - 1; } else { low = mid + 1; } } int pos = low - 1; if (pos < 0) { color[i] = cnt++; } else { color[i] = color[pos]; } } cout << 0 << " "; for (int i = 0; i < n; i++) { cout << color[i] << " \n"[i == n - 1]; } cout.flush(); return 0; }
#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...