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