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 "grader.h"
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,i,j,ii,jj,zx,xc,pas,pi;
pair <int, int> p[1009];
int ask(int q){
if(p[pi].first==q){
return p[pi].second;
}
pi++;p[pi]={q,Guess(q)};
return p[pi].second;
}
void rec(int q, int w){
if(q==w){
pas=q;
return;
}
if(rand()%2){
Guess(q);
c=Guess(w);
if(c==0){
pas=(q+w)/2;
return;
}
if(c==-1){
int mid=0;
if((q+w)%2!=0) mid=(q+w)/2; else mid=(q+w)/2-1;
rec(q,mid);
}else{
int mid=0;
mid=(q+w)/2+1;
rec(mid,w);
}
}else{
Guess(w);
c=Guess(q);
if(c==0){
pas=(q+w)/2;
return;
}
if(c==1){
int mid=0;
if((q+w)%2!=0) mid=(q+w)/2; else mid=(q+w)/2-1;
rec(q,mid);
}else{
int mid=0;
mid=(q+w)/2+1;
rec(mid,w);
}
}
}
int HC(int NN){
a=NN;pas=0;pi=0;
rec(1,a);
return pas;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |