#include "bits/stdc++.h"
using namespace std;
#define int long long
const int sz = 2e5 + 5;
const int inf = 1e18;
void solve()
{
int n;
cin >> n;
auto ask = [&](int x)
{
cout << "? " << x << endl;
int a;
cin >> a;
return a;
};
int l = 0, r = n + 1;
while (r - l > 1)
{
int mid = (l + r) >> 1;
int x = ask(mid);
if (!x)
{
cout << "= " << x << endl;
return;
}
else if (x == -1) l = mid;
else r = mid;
}
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int t = 1;
// cin >> t;
for(int i = 1; i <= t; i++) solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Integer parameter [name=k] equals to 0, violates the range [1, 5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Integer parameter [name=k] equals to 0, violates the range [1, 5] |
2 |
Halted |
0 ms |
0 KB |
- |