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<bits/stdc++.h>
using namespace std;
int main(){
int N;cin>>N;
int inf = 1;
int sup = N;
while(inf<sup){
int mid((inf+sup)/2);
cout<<"? "<<mid<<endl;
int P;cin>>P;
if(P==-1){
//right
inf = mid+1;
}else if(P==1){
sup=mid-1;
}else{
cout<<"= "<<mid<<endl;
return 0;
}
}
cout<<"= "<<inf<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |