#ifndef MUAATH_5
#include "gap.h"
#endif
#include <bits/stdc++.h>
#define ll long long
using namespace std;
long long findGap(int T, int N)
{
const ll n = N;
ll mn, mx;
MinMax(0, 1e18, &mn, &mx);
const ll blk = (mx-mn+1)/n;
vector<pair<ll, ll>> v;
ll sol = blk;
for (ll i = 1; mn+i*blk-1 <= mx; i++) {
ll lmn=-1, lmx=-1;
ll L = mn+(i-1)*(blk), R = mn+i*blk-1;
MinMax(L, R, &lmn, &lmx);
// cerr << i << ' ' << L << ' ' << R << ' ' << lmn << ' ' << lmx << endl;
if (lmn != -1) {
if (v.size())
sol = max(sol, lmn - v.back().second);
v.push_back({lmn, lmx});
}
}
return sol;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |