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>
using namespace std;
typedef long long ll;
const ll INF = 1000000000000000000LL;
long long findGap(int T, int N){
ll mn, mx;
MinMax(1, INF, &mn, &mx);
ll block = (mx-mn+N-2)/(N-1);
ll res = block;
ll posl = mn;
ll i;
for(i=mn; i+block+1 <= mx; i += block+1){
ll a, b;
MinMax(i, i+block+1, &a, &b);
if(a == -1) continue;
res = max(res, a-posl);
posl = b;
}
ll a, b;
MinMax(i, mx, &a, &b);
if(a != -1) res = max(res, a-posl);
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |