Submission #1206217

#TimeUsernameProblemLanguageResultExecution timeMemory
1206217borisAngelovGap (APIO16_gap)C++20
59.02 / 100
43 ms1208 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 - 1) / (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...