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 <bits/stdc++.h>
using namespace std;
const int MAXN = 555555;
const long long INF = 1e18 + 2e2;
typedef long long ll;
ll a[MAXN];
long long findGap(int SUBTASK, int n){
ll mn, mx;
MinMax(0, INF, &mn, &mx);
a[1] = mn;
a[n] = mx;
ll x = (mx - mn + n - 2) / (n - 1);
ll ans = x;
ll l = mn, last = mn;
while (l <= a[n]){
MinMax(l + 1, l + x, &mn, &mx);
if (mn == -1){
l += x;
} else {
ans = max(ans, mn - last);
l = last = mx;
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |