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 fi first
#define se second
#define pb push_back
#define vi vector<int>
#define pi pair<int, int>
#define all(x) (x).begin(),(x).end()
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
int l=1,r=n;
int res;
while (l<=r) {
int m=l+(r-l)/2;
cout << "? " << m << endl;
cin >> res;
if (res==0) {
cout << "= " << m << endl;
return 0;
}
else if (res==-1) {
l=m+1;
}
else {
r=m-1;
}
}
cout << "= " << l << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |