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<iostream>
#include<vector>
using namespace std;
int find_best(int n) {
if(n<=5000){
for(int i=0;i<n;i++){
vector<int>res=ask(i);
if(res[0]+res[1]==0)
return i;
}
}
int low=0;
for(int i=0;i<500;i++){
vector<int>res=ask(i);
low=max(low,res[0]+res[1]);
}
int curr=0;
while(curr<n){
vector<int>res=ask(curr);
if(res[0]+res[1]!=low){
if(res[0]+res[1]==0)
return curr;
curr++;
continue;
}
int l=curr,r=n;
while(l<r-1){
int mid=(l+r)/2;
vector<int>res2=ask(mid);
if(res2==res){
l=mid;
}else{
r=mid;
}
}
curr=r;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |