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;
#define ll long long
#define f first
#define s second
#define pb push_back
#define pi pair<int,int>
int main(){
int n;
cin >> n;
int l = 1, r = n;
while(l<=r){
int m = (l+r)/2;
cout << "? "<< m << endl;
cout << flush;
int ans;
cin >> ans;
if(ans==0){
cout << "= " << m << endl;
return 0;
}
else if(ans==1){
r = m-1;
}
else l = m+1;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |