Submission #944654

#TimeUsernameProblemLanguageResultExecution timeMemory
944654rocketsriCarnival (CEOI14_carnival)C++17
0 / 100
2 ms344 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<bool> a(n+1), c(n+1); int size=0, cnt=0; for(int i=1; i<=n; i++) { a[i]=true; size++; cout << size << " "; for(int j=1; j<=i; j++) { if(a[j]) cout << j << " "; } cout << endl; int x; cin >> x; if(x == size) { c[i] = ++cnt; continue; } int l=1, r=size; while(l < r-1) { int mid = (l+r)/2, sum=0; cout << mid-l+1 << " "; for(int j=1; j<i; j++) { sum += a[j]; if(a[j] && sum>=l && sum<mid) cout << j << " "; } cout << i << endl; cin >> x; if(x == mid-l+1) { l = mid; } else { r = mid; } } for(int j=1; j<i; j++) { l -= a[j]; if(a[j] && l==0) c[i] = c[j]; } a[i]=0; size--; } cout << 0 << " "; for(int i=1; i<=n; i++) { cout << c[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...