Submission #321098

#TimeUsernameProblemLanguageResultExecution timeMemory
321098MetBGap (APIO16_gap)C++14
0 / 100
71 ms1304 KiB
#include "gap.h" #include <bits/stdc++.h> typedef long long ll; typedef long double ld; using namespace std; ll findGap(int T, int N) { ll mn, mx; MinMax (1, 1e18, &mn, &mx); ld d = (ld) (mx - mn - 2) / N; ld l = mn + 1, r = mn + 1 + d; ll gap = 0, mx_old = mn; for (int i = 0; i < N - 1; i++) { MinMax(ceil (l), floor (r), &mn, &mx); if (mn != -1) { gap = max (gap, mn - mx_old); mx_old = mx; } l += d, r += d; } MinMax(ceil (l) + (ceil (l) == mx_old), floor (r), &mn, &mx); if (mn != -1) { gap = max (gap, mn - mx_old); mx_old = mx; } gap = max (gap, mx - mx_old); return gap; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...