Submission #541611

#TimeUsernameProblemLanguageResultExecution timeMemory
541611sidonColors (BOI20_colors)C++17
100 / 100
2 ms336 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; bool query(ll i) { cout << "? " << i << endl; cin >> i; return i; } int main() { ll N; cin >> N; ll i = 0, c = 0, l = 1, r = N, d = -1; for(; l < r; d = -d) { l = (l + r - 1) >> 1; i = max(i, ll(1) - (c += d * l++)); } query(i); l = 1, r = N, d = -1; for(; l < r; d = -d) { ll m = (l + r - 1) >> 1; if(query(i += d * m)) r = m; else l = m + 1; } cout << "= " << l << endl; }
#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...