Submission #1027738

#TimeUsernameProblemLanguageResultExecution timeMemory
1027738stdfloatGap (APIO16_gap)C++17
0 / 100
23 ms5516 KiB
#include <bits/stdc++.h> #include "gap.h" using namespace std; using ll = long long; ll findGap(int T, int N) { ll s, t; MinMax(0, (ll)1e18, &s, &t); int cnt = 1; ll ans = LLONG_MAX; while (N > 2 && s + 1 < t) { cnt++; assert(cnt <= (N + 1) / 2 && (N & 1)); ll x, y; MinMax(s + 1, t - 1, &x, &y); if (x == -1) break; ans = min({ans, x - s, t - y}); s = x; t = y; N -= 2; } return min(ans, (s < t ? t - s : LLONG_MAX)); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...