This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
int find_best(int n) {
vector<int>cur = ask(0);
int idx = 0;
if(!cur[0]&&!cur[1])
return 0;
while(1){
int l = idx,r = min(n-1,idx+500);
int premid = -1;
while(l<r){
int mid = (l+r+1)/2;
assert(premid!=mid);
premid = mid;
if(ask(mid)==cur)l = mid;
else r = mid-1;
}
cur = ask(l+1);
idx = l+1;
assert(idx<n);
if(!cur[0]&&!cur[1])
return idx;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |