#include "bits/stdc++.h"
using namespace std;
signed main () {
int n;
cin >> n;
cout << "? 1" << endl;
int x;
cin >> x;
int r = n + 1;
for(int l = 1, f = 1;; f = 1 - f) {
if(l + 2 >= r) break;
if(f) {
r -= 2;
cout << "? " << r << endl;
cin >> x;
if(x == 0) {
cout << "? " << r - (r - l + 1) << endl;
cin >> x;
if(x == 1) {
cout << "= " << (r - l + 1) << endl;
}else {
cout << "= " << (r - l + 1) + 1 << endl;
}
return 0;
}
}else {
l += 2;
cout << "? " << l << endl;
cin >> x;
if(x == 0) {
cout << "? " << l + (r - l + 1) << endl;
cin >> x;
if(x == 1) {
cout << "= " << (r - l + 1) << endl;
}else {
cout << "= " << (r - l + 1) + 1 << endl;
}
return 0;
}
}
}
cout <<"= 1" << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (4 queries) |
2 |
Correct |
0 ms |
344 KB |
OK (5 queries) |
3 |
Incorrect |
1 ms |
344 KB |
Wrong guess |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (4 queries) |
2 |
Correct |
0 ms |
344 KB |
OK (5 queries) |
3 |
Incorrect |
1 ms |
344 KB |
Wrong guess |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (4 queries) |
2 |
Correct |
0 ms |
344 KB |
OK (5 queries) |
3 |
Incorrect |
1 ms |
344 KB |
Wrong guess |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (4 queries) |
2 |
Correct |
0 ms |
344 KB |
OK (5 queries) |
3 |
Incorrect |
1 ms |
344 KB |
Wrong guess |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (4 queries) |
2 |
Correct |
0 ms |
344 KB |
OK (5 queries) |
3 |
Incorrect |
1 ms |
344 KB |
Wrong guess |
4 |
Halted |
0 ms |
0 KB |
- |