#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;
if(n <= 64) {
ask(1);
int l = 1, r = n, p = 0, c = - 1;
while(l < r) {
if(!p) {
int u = ask(r);
if(!u) {
break;
}
c = r - l;
l += 1;
}
else {
int u = ask(l);
if(!u) {
break;
}
c = r - l;
r -= 1;
}
p ^= 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... |