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