#include <bits/stdc++.h>
using namespace std;
using ll = long long;
bool ask(ll x) {
cout << "? " << x << endl;
cin >> x; return x;
}
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
ll n;
cin >> n;
ask(1);
ll l = 1, r = n;
while (l < r) {
ll mid = (l + r) / 2;
if (ask(mid + 1)) r = mid;
else l = mid + 1;
ask(1);
}
cout << "= " << l << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Hair color 1 was used multiple times |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Hair color 1 was used multiple times |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Hair color 1 was used multiple times |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Hair color 1 was used multiple times |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Hair color 1 was used multiple times |
2 |
Halted |
0 ms |
0 KB |
- |