# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
948973 |
2024-03-18T17:50:02 Z |
LucaIlie |
Colors (BOI20_colors) |
C++17 |
|
0 ms |
344 KB |
#include <bits/stdc++.h>
using namespace std;
const int C = 35;
int prv = 0;
bool query( long long c ) {
cout << "? " << c << endl;
bool ans = (abs( prv - c ) >= C);
prv = c;
cout << ans << endl;
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 - (1 << ((int)log2( n ))), c = 0;
for ( int k = log2( n ); k >= 0; k-- ) {
if ( c + (1 << k) >= n )
continue;
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 |
Incorrect |
0 ms |
344 KB |
Token parameter [name=cmd] equals to "0", doesn't correspond to pattern "[?=]" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Token parameter [name=cmd] equals to "0", doesn't correspond to pattern "[?=]" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Token parameter [name=cmd] equals to "0", doesn't correspond to pattern "[?=]" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Token parameter [name=cmd] equals to "0", doesn't correspond to pattern "[?=]" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Token parameter [name=cmd] equals to "0", doesn't correspond to pattern "[?=]" |
2 |
Halted |
0 ms |
0 KB |
- |