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 arr[N];
set<ll> s;
for(int i = 0; i < N; i++){
ll l = 0, r = 1e18, mn, mx;
if(i > 0)
l = arr[i-1] + 1;
if(SZ(s))
r = *s.begin();
while(r - l > 1){
ll m = (l + r) / 2;
MinMax(l, m, &mn, &mx);
if(mn == -1){
l = m;
} else{
s.insert(mn);
s.insert(mx);
r = mx;
}
}
arr[i] = *s.begin();
s.erase(s.find(arr[i]));
}
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... |