Submission #1206219

#TimeUsernameProblemLanguageResultExecution timeMemory
1206219borisAngelovGap (APIO16_gap)C++20
0 / 100
39 ms1096 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; const long long inf = 1e18; long long findGap(int T, int N) { int n = N; long long a, b; MinMax(0, inf, &a, &b); if (n == 2) { return b - a; } long long step = (b - a) / (1LL * (n - 1)) + 1; long long last = a, ans = step; for (long long i = a; i <= b; i += step) { long long x, y; MinMax(i, i + step - 1, &x, &y); if (x == -1) continue; ans = max(ans, x - last); last = y; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...