Submission #686640

#TimeUsernameProblemLanguageResultExecution timeMemory
686640null_aweColors (BOI20_colors)C++14
0 / 100
1 ms208 KiB
#include <iostream> #include <set> using namespace std; #define int long long int n, at; set<int> s; bool qry(int x) { if (at + x <= n) at += x; else at -= x; if (s.count(at)) exit(0); cout << "? " << at << endl; s.insert(at); bool ans; cin >> ans; return ans; } int32_t main() { cin >> n; bool added = true; int left = n; at = 1; for (int i = (left + 1) / 2; i > 0; left >>= 1, i = (left + 1) / 2) { if (!added) at += i; added = !added; if (i == 1) break; } cout << "? " << at << endl; int tmp; cin >> tmp; s.insert(at); int sum = 0; left = n; for (int i = (left + 1) / 2; i > 0; left >>= 1, i = (left + 1) / 2) { int chg = sum + i; if (chg >= n) continue; if (!qry(chg)) sum = chg; } cout << "= " << sum + 1 << '\n'; return 0; } /* 49 25 12 6 3 2 1 */
#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...