#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb(a) push_back(a)
#define pp pop_back
#define mp(a, b) make_pair(a, b)
int32_t main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n;
cin >> n;
bool b=0;
int l=1, r=n, x=(n+2)/3, y, a;
cout << "? " << x << "\n" << flush;
cin >> a;
while (l<r) {
if (!b) y=x+(l+r)/2;
else y=x-(l+r)/2;
cout << "? " << y << "\n" << flush;
cin >> a;
if (!a) l=abs(y-x)+1;
else r=abs(y-x);
b=1-b;
x=y;
}
cout << "= " << l << "\n";
return 0;
}
# | 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... |