Submission #701644

#TimeUsernameProblemLanguageResultExecution timeMemory
701644US3RN4M3Colors (BOI20_colors)C++17
0 / 100
1 ms300 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; bool ask(ll pos) { pos++; cout << "? " << pos << endl; bool res; cin >> res; return res; } main() { ll n; cin >> n; bool parity = true; ll lo = 1, hi = n; ll pos = (n - 1) / 3; ask(pos); while(lo != hi) { ll mid = (lo + hi - 1) / 2; if(parity) { pos += mid; } else { pos -= mid; } parity = !parity; if(ask(pos)) { hi = mid; } else { lo = mid + 1; } } cout << "= " << lo << endl; }

Compilation message (stderr)

Colors.cpp:10:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   10 | main() {
      | ^~~~
#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...