// Success consists of going from failure to failure without loss of enthusiasm
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
template<class T> using V = vector<T>;
using vi = V<int>;
int main() {
cin.tie(0)->sync_with_stdio(0);
int N; cin >> N;
auto ask = [&](int l, int r) {
if (l < 0 || r >= N) return 0;
cout << "? " << l + 1 << " " << r + 1 << endl;
int res; cin >> res; return res;
};
int odd = 0, even = 0;
for(int i = 0; i < N; i++) {
while(ask(i - odd - 1, i + odd + 1)) odd++;
while(ask(i - even, i - even + 1)) even++;
}
cout << max(2 * odd + 1, 2 * even) << nl;
exit(0-0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
61 ms |
344 KB |
invalid token |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
61 ms |
344 KB |
invalid token |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
843 ms |
344 KB |
invalid token |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
61 ms |
344 KB |
invalid token |
2 |
Halted |
0 ms |
0 KB |
- |