Submission #90013

#TimeUsernameProblemLanguageResultExecution timeMemory
90013nikolapesic2802The Big Prize (IOI17_prize)C++14
0 / 100
104 ms456 KiB
#include <bits/stdc++.h> #include "prize.h" using namespace std; int find_best(int n) { int N=2e5+5; int lo=(int)sqrt(N); int maxx=0; for(int i=0;i<lo;i++) { vector<int> tr=ask(i); int t=tr[0]+tr[1]; if(t==0) return i; maxx=max(maxx,t); } int nasao=0; int last=n-1; while(true) { int l=last,r=last; while(l<r) { int m=(l+r+1)>>1; vector<int> tr=ask(m); int t=tr[0]+tr[1]; if(t==0) return m; if(t!=maxx) { l=m; continue; } if(tr[1]>nasao) l=m+1; else r=m-1; } vector<int> tr=ask(l); int t=tr[0]+tr[1]; if(t==0) return l; last=l-1; nasao++; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...