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<iostream>
using namespace std;
int main(){
int N;
cin>>N;
N+=1;
int left=1, right=N;
while(1){
int tmp=(right-left)/2+left;
int ans;
cout<<"?"<<" "<<tmp;
cout.flush();
cin>>ans;
if(ans==-1){
right=tmp;
}
else if(ans==0){
cout<<"= "<<tmp;
break;
}
else{
left=tmp;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |