Submission #71657

#TimeUsernameProblemLanguageResultExecution timeMemory
71657someone_aaCarnival (CEOI14_carnival)C++17
100 / 100
15 ms580 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 200; int qinit[maxn], ind[maxn]; int arr[maxn], n, br; int query(int li, int ri, int i) { int answ; cout<<(ri-li+2)<<" "; for(int i=li;i<=ri;i++) { cout<<ind[i]<<" "; } cout<<i<<"\n"; fflush(stdout); cin>>answ; return answ; } int bin_search(int i, int l, int r) { int mid = (l+r)/2; if(l==r) return l; else { if(query(l, mid, i) == (mid-l+1)) return bin_search(i, l, mid); else return bin_search(i, mid+1,r); } } void init() { int answ; for(int i=1;i<=n;i++) { cout<<i<<" "; for(int j=1;j<=i;j++) { cout<<j<<" "; } cout<<"\n"; fflush(stdout); cin>>answ; qinit[i] = answ; } br = 1; for(int i=1;i<=n;i++) { if(qinit[i] > qinit[i-1]) { ind[br] = i; arr[i] = br++; } } br--; for(int i=1;i<=n;i++) { if(arr[i] == 0) { arr[i] = bin_search(i, 1, br); } } cout<<"0 "; for(int i=1;i<=n;i++) { cout<<arr[i]<<" "; } cout<<"\n"; fflush(stdout); } int main() { cin>>n; init(); 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...