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<vector>
#include<map>
#include<utility>
using namespace std;
map<int, map<int, pair<int,int> > > M;
int slv(int l, int r) {
if (l == r) {return(l);}
int mid = (l + r) >> 1;
vector<int> res = ask(mid);
if (res[0] + res[1] == 0) {return(mid);}
int r1 = res[0] ? slv(l, mid-1) : -1, r2 = res[1] ? slv(mid+1, r) : -1;
return(r1 != -1 ? r1 : r2);
}
int find_best(int n) {
return(slv(0, n-1));
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |