# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
948960 |
2024-03-18T17:35:47 Z |
LucaIlie |
Colors (BOI20_colors) |
C++17 |
|
0 ms |
432 KB |
#include <bits/stdc++.h>
using namespace std;
/*const int C = 4;
int prv = 0;
bool query( long long c ) {
cout << "? " << c << endl;
bool ans = (abs( prv - c ) >= C);
prv = c;
return ans;
}*/
bool query( long long c ) {
cout << "? " << c << endl;
bool ans;
cin >> ans;
return ans;
}
void answer( long long c ) {
cout << "= " << c << endl;
}
int main() {
long long n;
cin >> n;
query( n / 2 );
int l = n / 2, c = 0;
for ( int k = log2( n ); k >= 0; k-- ) {
if ( l > n / 2 ) {
l -= c + (1 << k);
if ( !query( l ) )
c += (1 << k);
} else {
l += c + (1 << k);
if ( !query( l ) )
c += (1 << k);
}
}
answer( c + 1 );
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (4 queries) |
2 |
Runtime error |
0 ms |
432 KB |
Execution killed with signal 13 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (4 queries) |
2 |
Runtime error |
0 ms |
432 KB |
Execution killed with signal 13 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (4 queries) |
2 |
Runtime error |
0 ms |
432 KB |
Execution killed with signal 13 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (4 queries) |
2 |
Runtime error |
0 ms |
432 KB |
Execution killed with signal 13 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (4 queries) |
2 |
Runtime error |
0 ms |
432 KB |
Execution killed with signal 13 |
3 |
Halted |
0 ms |
0 KB |
- |