#include <bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
int L = 1, R = n;
while (L < R) {
int M = (L + R) / 2;
cout << "? " << 1 << endl;
bool r; cin >> r;
cout << "? " << 1 + M << endl;
cin >> r;
if (r)
R = M;
else
L = M + 1;
}
cout << "= " << L;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Hair color 1 was used multiple times |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Hair color 1 was used multiple times |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Hair color 1 was used multiple times |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Hair color 1 was used multiple times |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Hair color 1 was used multiple times |
2 |
Halted |
0 ms |
0 KB |
- |