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 <bits/stdc++.h>
#include "prize.h"
#define ll long long
#define pb push_back
#define x first
#define y second
#define sz(u) (int)(u.size())
#define all(u) u.begin(),u.end()
using namespace std;
vector<int> tmp;
int find_best(int N){
int ptr=0;
int curL=1, curR=1, cnt=0;
while(1){
assert(ptr<N && cnt<=9500);
tmp=ask(ptr);
cnt++;
if(tmp[0]+tmp[1]==0) break;
curL=tmp[0];
curR=tmp[1];
int l=ptr,r=N-1;
while(l<r){
int md=(l+r+1)/2;
tmp=ask(md);
cnt++;
if(tmp[0]!=curL || tmp[1]!=curR) r=md-1;
else l=md;
}
ptr=l+1;
}
return ptr;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |