#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/*
void MinMax(long long, long long, long long*, long long*);
*/
long long findGap(int T, int N) {
ll L=0, R=0;
MinMax(0LL, (ll)1e18, &L, &R);
ll sz = (R-L+N-2) / (N - 1);
ll l = L, r = L + sz;
ll ans = sz;
ll last = L;
for (int i=0; i<N-1; i++, l = min(R, l+sz+1), r = min(R, r + sz+1)) {
// cout << l << ' ' << r << '\n';
ll a=0, b=0;
MinMax(l, r, &a, &b);
if (a == -1) continue;
ans = max(ans, a - last);
last = b;
}
return ans;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |