Submission #768858

#TimeUsernameProblemLanguageResultExecution timeMemory
768858adrilenColors (BOI20_colors)C++17
0 / 100
0 ms208 KiB
//#pragma GCC optimize("O3") #include<bits/stdc++.h> using namespace std; using ll = long long; using arr = array<int, 2>; using arrr = array<int, 3>; // mt19937 rng(1985022984); ll last = -1; set <ll> used = { -1 }; int query(int p) { used.insert(p); cout << "? " << p << endl; int a; cin >> a; last = p; return a; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll n; cin >> n; ll l = 1, r = n, mid; ll a, b, c, d; while (l != r) { mid = (l + r) >> 1; a = -1, b = -1; while (used.count(a) == 1 || used.count(b) == 1) { a = rand() % (n - mid); b = a + mid; } c = query(a); c++; d = query(b); if (d) { r = mid; } else { l = mid + 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...