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 "gap.h"
#include <algorithm>
#include <iostream>
long long findGap(int, int N) {
long long a1{}, aN{};
MinMax(0, (long long)1e18, &a1, &aN);
long long d = (aN - a1 + N - 2) / (N - 1), ans = d;
for(long long i = a1, p = a1; i <= aN; i += d + 1) {
long long s{}, e{};
MinMax(i, std::min(i + d, aN), &s, &e);
if(~s)
ans = std::max(ans, s - p), p = e;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |