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 l = 1, r = n;
while(l <= r){
int mid = l + (r - l ) /2, check;
cout<<"? "<<mid;
cout<<endl;
cin>>check;
if(check == -1){
l = mid + 1;
}
else if(check == 1){
r = mid - 1;
}
else{
cout<<"= "<<mid<<endl;
return 0;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |