#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
bool ask(ll p) {
cout << "? " << p << endl;
bool ans;
cin >> ans;
return ans;
}
int main() {
ll n;
cin >> n;
ll l = 1;
ll r = n;
ask(l++);
bool one = true;
int c = n;
while (l < r) {
if (!ask(r--)) {
one = false;
break;
}
c--;
if (!ask(l++)) {
one = false;
break;
}
c--;
}
if (n % 2 == 0 && one && ask(l))
c = 1;
cout << "= " << c << endl;
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... |