Submission #854236

#TimeUsernameProblemLanguageResultExecution timeMemory
854236Trisanu_DasColors (BOI20_colors)C++17
100 / 100
3 ms796 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...