Submission #930352

#TimeUsernameProblemLanguageResultExecution timeMemory
930352ByeWorldCarnival (CEOI14_carnival)C++14
0 / 100
4 ms344 KiB
#include <bits/stdc++.h> #define fi first #define se second #define pb push_back //#define int long long #define lf (id<<1) #define rg ((id<<1)|1) #define md ((l+r)>>1) using namespace std; typedef pair<int,int> pii; typedef pair<pii,int> ipii; const int INF = 1e9+10; const int MAXN = 1e6+10; int n; int a[200], cnt, val; vector <int> vec; int bin(int idx){ int l=1, r=vec.size()-1, mid=-1; if(l==r){ return l; } while(l<r){ mid = md; cout << mid-l+2 << ' '; // l --> mid for(int i=l; i<=mid; i++) cout << vec[i] << ' '; cout << idx << endl; int te; cin >> te; if(te == mid-l+1){ // ada di segment l --> mid r = mid; } else l = mid+1; if(l==r){ return l; } } return -1; } signed main() { cin >> n; a[1] = ++cnt; vec.pb(-1); vec.pb(1); for(int i=2; i<=n; i++){ cout << i << ' '; for(int j=1; j<=i; j++) cout << j << ' '; cout << endl; int num; cin >> num; if(num == cnt+1){ a[i] = ++cnt; vec.pb(i); } else { int idx = bin(i); assert(idx != -1); a[i] = a[idx]; } } 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...