This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// https://oj.uz/problem/view/IOI17_prize
#include "prize.h"
#include<array>
// simple wrapper over ask
std::array<int,2> sk(int x){
auto v=ask(x);
return {{v[0],v[1]}};
}
int f(int l,std::array<int,2> lp,int r,std::array<int,2> rp){
// return -1 if not found inside ]l..r[ , else index
if(l+1==r)return -1;
if(lp==rp)return -1; // [l] == [r], and no number > l or r in range
int mid=(l+r)/2;
auto mp=sk(mid);
if(mp[0]+mp[1]==0)return mid;
int res=f(l,lp,mid,mp);
if(res>=0)return res;
return f(mid,mp,r,rp);
}
int find_best(int n) {
return f(-1,{0,n},n,{n,0});
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |