# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1027720 | 2024-07-19T09:26:37 Z | stdfloat | Gap (APIO16_gap) | C++17 | 0 ms | 0 KB |
#include <bits/stdc++.h> #include "gap.h" #include "grader.cpp" using namespace std; using ll = long long; ll findGap(int T, int N) { ll s, t; MinMax(0, (ll)1e18, &s, &t); ll ans = LLONG_MAX; while (N > 2 && s + 1 < t) { 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)); }