Submission #532290

#TimeUsernameProblemLanguageResultExecution timeMemory
532290devariaotaCarnival (CEOI14_carnival)C++17
0 / 100
24 ms200 KiB
#include <bits/stdc++.h> using namespace std; int main(){ cin.tie(0) -> ios_base::sync_with_stdio(0); int n; cin >> n; vector<int> a(n + 1); auto ask = [&](int l, int r) -> int { cout << r - l + 1 << " "; for(int i=l;i<=r;i++) { cout << i << " "; } cout << endl; int ret; cin >> ret; return ret; }; a[1] = 1; for(int i=2,cur=1;i<=n;i++) { if(ask(1, i) != ask(1, i-1)) { a[i] = ++cur; continue; } int l = 1, r = i - 1; while(l < r) { int mid = (l + r + 1) / 2; if(ask(mid, i-1) == ask(mid, i)) { l = mid; } else { r = mid - 1; } } a[i] = l; } cout << "0 "; for(int i=1;i<=n;i++) { cout << a[i] << " "; } cout << endl; }
#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...