Submission #1012137

#TimeUsernameProblemLanguageResultExecution timeMemory
1012137zsomborCarnival (CEOI14_carnival)C++17
100 / 100
10 ms420 KiB
#include <iostream> #include <vector> using namespace std; int n, c = 2; vector <int> v(200, 1); vector <int> d(200, 1); int query(int x, int r) { cout << r + 1 << " "; for (int i = 1; i <= r; i++) cout << i << " "; cout << x << endl; cin >> x; return x; } void solve(int x) { int l = 0, r = x, m; while (r - l > 1) { m = (l + r) / 2; query(x, m) > d[m] ? l = m : r = m; } v[x] = (r == x ? c++ : v[r]); d[x] = d[x - 1] + (r == x); } int main() { cin >> n; for (int i = 2; i <= n; i++) solve(i); cout << "0 "; for (int i = 1; i <= n; i++) cout << v[i] << " "; }
#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...