#include<bits/stdc++.h>
using namespace std;
int ask(int n) {
cout << "? " << n;
cout << endl;
int x;
cin >> x;
return x;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
int l = 1, r = n, c = - 1;
while(l <= r) {
int mid = (l + r) / 2;
ask(1);
int ok = ask(mid);
if(ok) {
r = mid - 1;
c = mid;
}
else {
l = mid + 1;
}
}
cout << "= " << c;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |