Submission #1094518

#TimeUsernameProblemLanguageResultExecution timeMemory
1094518andrewpColors (BOI20_colors)C++14
0 / 100
1 ms344 KiB
//Dedicated to my love, ivaziva #pragma GCC optimize("Ofast") #include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; using ll = int64_t; #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define dbg(x) cerr << #x << ": " << x << '\n'; const ll maxn = (ll)(1e18); ll n; int ask(ll x) { cout << "? " << x << endl; int ret; cin >> ret; return ret; } void Solve() { cin >> n; ll l = 1, r = n, lst = 1, ans = maxn; ask(1); while (l <= r) { ll mid = (l + r) / 2; dbg(mid); int ret = ask(mid + lst); if (ret) { r = mid - 1; ans = mid; lst = mid + lst; } else { l = mid + 1; } } cout << "= " << ans << endl; } int32_t main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cerr.tie(nullptr); Solve(); 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...