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 "bits/stdc++.h"
using namespace std;
#include "gap.h"
#ifndef EVAL
#include "grader.cpp"
#endif
#define ar array
typedef long long ll;
const ll inf = 1e18;
ll findGap(int t, int n){
if(t == 1){
ll l = 0, r = inf, mn, mx;
vector<ll> a;
while(l < r){
MinMax(l, r, &mn, &mx);
a.push_back(mn);
if(mn != mx) a.push_back(mx);
l = mn + 1, r = mx - 1;
}
sort(a.begin(), a.end());
ll res = 0;
for(int i=1;i<n;i++){
res = max(res, a[i] - a[i-1]);
}
return res;
}
ll l = 0, r = inf, mn, mx;
MinMax(l, r, &mn, &mx);
ll B = (mx - mn) / n, last = mn, R = mx;
ll res = B;
for(l=mn;last<R;l += B + 1){
MinMax(l, l + B, &mn, &mx);
if(mn == -1) continue;
res = max(res, mn - last);
last = mx;
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |