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;
using i64 = long long;
pair <i64,i64> qry(i64 s, i64 t){
i64 mn, mx;
MinMax(s, t, &mn, &mx);
return {mn, mx};
}
long long findGap(int T, int n){
auto [mn, mx] = qry(0, (i64)1e18);
i64 lb = (mx - mn) / (n - 1), opt = lb;
i64 pv = mn, j = mn + 1;
while ( j <= mx ){
auto [l, r] = qry(j, j + lb - 1);
if ( l != -1 ){
opt = max(opt, l - pv);
}
pv = r;
j += lb;
}
return opt;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |