Submission #320753

#TimeUsernameProblemLanguageResultExecution timeMemory
320753gustasonCarnival (CEOI14_carnival)C++17
0 / 100
21 ms492 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; cin >> n; int id[n+1]; int last = 2; id[1] = 1; for(int i = 2; i <= n; i++) { int L = 1, R = i-1, ans = -1; //cout << i << ":\n"; while(L <= R) { int mid = ceil((double) (L + R) / 2); // try to go right int with, without; cout << R - mid + 1 << " "; for(int j = mid; j <= R; j++) { cout << j << " "; } fflush(stdout); cin >> without; cout << R - mid + 2 << " "; for(int j = mid; j <= R; j++) { cout << j << " "; } cout << i << " "; fflush(stdout); cin >> with; if (with == without) { ans = R; R = mid - 1; continue; } // try left if (L == R) break; cout << mid - L << " "; for(int j = L; j < mid; j++) { cout << j << " "; } fflush(stdout); cin >> without; cout << mid - L + 1 << " "; for(int j = L; j < mid; j++) { cout << j << " "; } cout << i << " "; fflush(stdout); cin >> with; if (with == without) { ans = L; L = mid + 1; } else break; } if (ans == -1) { ans = last++; } id[i] = ans; } cout << "0 "; for(int i = 1; i <= n; i++) { cout << id[i] << " "; } fflush(stdout); return 0; } //~ check for overflows
#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...