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>
typedef long long ll;
using namespace std;
ll ar[100010]; int tp;
ll mx, mn, gp;
long long findGap(int T, int N)
{
MinMax(0, 1000000000000000000ll, &mn, &mx);
gp=(mx-mn+N-2)/(ll)(N-1);
ll n, x;
for (ll i=mn; i<mx; i+=gp) {
MinMax(i, min(i+gp-1, mx-1), &n, &x);
if (n==-1&&x==-1) continue;
if (n==x) ar[tp++]=n;
else {
ar[tp++]=n; ar[tp++]=x;
}
}
ar[tp++]=mx;
ll ans=0;
for (int j=0; j<tp-1; j++) ans=max(ans, ar[j+1]-ar[j]);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |