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>
#include "gap.h"
using namespace std;
#define f first
#define s second
#define ll long long
#define ii pair<ll, ll>
ii get(ll a, ll b) {
b = min(b, (ll)1e18);
ii x;
MinMax(a, b, &x.f, &x.s);
return x;
}
long long findGap(int T, int N)
{
ii boundary = get(1, 1e18);
ll block = (boundary.s-boundary.f)/(N-1);
ll prev = boundary.f;
ll ans = 0;
for (ll cur = boundary.f + 1; cur < boundary.s; cur += block) {
ii thing = get(cur, cur+block);
ans = max(ans, thing.f - prev);
prev = thing.s;
}
ans = max(ans, boundary.s - prev);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |