Submission #948973

#TimeUsernameProblemLanguageResultExecution timeMemory
948973LucaIlieColors (BOI20_colors)C++17
0 / 100
0 ms344 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...