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>
#include <stdlib.h>
#include "gap.h"
#define I inline void
using ll = long long ;
using ld = long double ;
using namespace std ;
long long findGap(int T, int N)
{
ll lo = 0, hi = 1e18 ;
multiset<ll> s ;
while(lo <= hi){
ll mn ,mx ;
MinMax(lo , hi , &mn , &mx) ;
if( (mn) != -1){
s.insert( mn ) ;
s.insert( mx ) ;
}
if( mn == mx ){
break ;
}
lo = mn+ 1;
hi = mx - 1;
}
ll ans = 0 ;
ll l = -1 ;
for(auto u : s){
if(l>=0){
ans = max(ans , u - l) ;
}
l = u ;
}
return ans ;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |