Submission #718986

#TimeUsernameProblemLanguageResultExecution timeMemory
718986nguyentunglamGap (APIO16_gap)C++17
70 / 100
61 ms1292 KiB
#include<bits/stdc++.h> using namespace std; #include "gap.h" long long findGap(int T, int n) { long long mn, mx; MinMax(0, 1e18, &mn, &mx); long long delta = (mx - mn) / (n - 1) + ((mx - mn) % (n - 1) > 0); long long s = mn + 1, last = mn; long long res = delta, lmt = mx - 1; long long a = 1e18, b = 0, c = mn, d = mx; while (s <= lmt) { long long t = min(lmt, s + delta); MinMax(s, t, &mn, &mx); if (mn != -1) { a = min(a, mn); b = max(b, mx); res = max(res, mn - last); last = mx; } s = t + 1; } if (a == 1e18) res = max(res, d - c); else res = max(res, a - c), res = max(res, d - b); return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...