#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
long long findGap(int T, int N)
{
int n = N;
long long a, b;
MinMax(0, inf, &a, &b);
if (n == 2)
{
return b - a;
}
long long step = (b - a - 1) / (1LL * (n - 1)) + 1;
long long last = a, ans = step;
for (long long i = a; i <= b; i += step)
{
long long x, y;
MinMax(i, i + step - 1, &x, &y);
if (x == -1) continue;
ans = max(ans, x - last);
last = y;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |