This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
while (s <= lmt) {
long long t = min(lmt, s + delta);
MinMax(s, t, &mn, &mx);
if (mn != -1) {
res = max(res, mn - last);
last = mx;
}
s = t + 1;
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |