Submission #1094513

#TimeUsernameProblemLanguageResultExecution timeMemory
1094513andrewpColors (BOI20_colors)C++14
0 / 100
0 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 = maxn + 1, 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; } 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...