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;
#define lli long long int
int find_best(int n){
vector<int>a(2);
vector<int>vb(n,0);
int x=0,y=n-1,z,xx=0,yy=n-1,p;
int c=9877;
while(x!=y){
z=(xx+yy)/2;
p=z;
if(vb[z]){
z++;
while(vb[z]){
z++;
if(z>yy){
z=xx;
}
}
if(p==z){
if(yy==y){
y=xx+1;
yy=y;
}
if(xx==x){
x=yy-1;
xx=x;
}
z=xx;
while(vb[z]){
x++;
xx++;
z++;
}
}
}
a=ask(z);
vb[z]=1;
if(a[0]+a[1]==0){
return z;
}
else if(a[1]+a[0]==1){
if(a[1]){
x=z+1;
}
else{
y=z-1;
}
xx=x;
yy=y;
}
else{
a[0]=(9347*c)%a[0];
a[1]=(9347*c)%a[1];
if(a[0]>a[1]){
xx=x;
yy=z-1;
}
else{
xx=z+1;
yy=y;
}
}
}
return x;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |