#include <bits/stdc++.h>
using namespace std;
int query( long long c ) {
cout << "? " << c << endl;
int ans;
cin >> ans;
return ans;
}
void answer( long long c ) {
cout << "= " << c << endl;
}
int main() {
long long n;
cin >> n;
long long l = 0, r = n;
while ( r - l > 1 ) {
long long c = (l + r) / 2;
query( 1 );
if ( query( c + 1 ) )
r = c;
else
l = c;
}
answer( r );
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 |
- |