#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define pb push_back
#define ff first
#define ss second
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n; cin>>n;
auto ask = [&](int x){
cout<<"? "<<x<<"\n";
cout.flush();
bool t; cin>>t;
return t;
};
auto check = [&](int x){
if (x == n){
ask(1);
return !ask(n);
}
ask(1);
return ask(x + 1);
};
int l = 1, r = n;
while (l + 1 < r){
int m = (l + r) / 2;
if (check(m)){
r = m;
}
else {
l = m + 1;
}
}
if (check(l)) r = l;
cout<<"= "<<r<<"\n";
}
# | 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... |