Submission #102807

#TimeUsernameProblemLanguageResultExecution timeMemory
102807alexpetrescuGap (APIO16_gap)C++14
0 / 100
95 ms1172 KiB
#include <algorithm> #include "gap.h" long long findGap(int T, int N) { long long R = 1000000000000000000LL; long long e, r; MinMax(0, R, &e, &r); r -= e; long long dist = (r + N - 2) / (N - 1), st = e, ans = 0, val = -1; for (int i = 1; i < N; i++) { long long a, b; MinMax(st, st + dist, &a, &b); st += dist + 1; if (a != -1) { if (val != -1) ans = std::max(ans, a - val); val = b; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...