# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
289790 | Bill_00 | The Big Prize (IOI17_prize) | C++14 | 1 ms | 392 KiB |
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 ans,m;
int p[200001]={0};
void search(int mid,int l,int r,int l1,int r0){
cout << mid << ' ' << l << ' ' << r << endl;
int ll=0,rr=0;
vector<int>res=ask(mid);
if(res[0]+res[1]==0){
ans=mid;
return;
}
if(l==r){
return;
}
if(res[0]==0){
ll++;
}
if(res[1]==0){
rr++;
}
if(l1==res[1]){
ll++;
}
if(r0==res[0]){
rr++;
}
if(rr==0){
if(l+1==mid) return;
search(mid+r>>1,mid,r,res[1],r0);
}
if(ll==0){
if(mid+1==r) return;
search(mid+l>>1,l,mid,l1,res[0]);
}
}
int find_best(int n){
m=n;
/*for(int i = 0; i < n; i++) {
std::vector<int> res = ask(i);
if(res[0] + res[1] == 0)
return i;
}*/
int l=0,r=n-1;
int mid=(l+r)>>1;
vector<int>lll=ask(l);
vector<int>rrr=ask(r);
search(mid,l,r,lll[1],rrr[0]);
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |