# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1083354 | 2024-09-03T02:41:07 Z | Seungni | Gap (APIO16_gap) | C++17 | 0 ms | 0 KB |
#include <bits/stdc++.h> //#include "gap.h" using namespace std; using ll = long long; using pii = pair<int, int>; ll ans[100005]; long long findGap(int T, int N) { ll l = 0, r = 1e18 + 500; int lidx = 0, ridx = N - 1; ll mn, mx; for (int i = 0; i < (N + 1) / 2; i++) { MinMax(l, r, &mn, &mx); ans[lidx++] = mn, ans[ridx--] = mx; l = mn + 1, r = mx - 1; } ll ret = 0; for (int i = 1; i < N; i++) ret = max(ret, ans[i] - ans[i - 1]); return ret; }