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>
#define ll long long
#define SZ(x) ((int) (x).size())
using namespace std;
void MinMax(long long s, long long t, long long *mn, long long *mx);
long long findGap(int T, int N){
ll l = 0, r = 1e18, mn, mx, arr[N];
multiset<ll> ms;
for(int i = 0; i < N; i++){
while(r - l > 1){
ll m = (l + r) / 2;
MinMax(l, m, &mn, &mx);
if(mn == -1){
break;
} else{
l = mn + 1;
r = mx - 1;
ms.insert(mn);
ms.insert(mx);
}
}
arr[i] = *ms.begin();
ms.erase(arr[i]);
if(SZ(ms)){
l = arr[i] + 1;
r = *ms.begin();
} else{
l = arr[i] + 1;
r = 1e18;
}
}
ll ans = 0;
for(int i = 1; i < N; i++){
ans = max(ans, arr[i] - arr[i-1]);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |