# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
740053 | Cutebol | Gap (APIO16_gap) | C++17 | 0 ms | 0 KiB |
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 ;
#define int long long
long long findGap(int T, int n)
{
vector <int> vec ;
int ans = 0 ;
int l = 1 , r = 1e18 , mn , mx , pl = -1 , pr ;
while ( l < r ){
MinMax( l , r , &mn , &mx ) ;
if ( mn == -1 || mx == -1 ) break ;
vec.push_back(mn) ;
vec.push_back(mx) ;
l = mn + 1 , r = mx-1 ;
}
sort ( vec.begin() , vec.end() ) ;
for ( int i = 0 ; i < n-1 ; i ++ ) ans = max ( ans , vec[i+1]-vec[i] ) ;
return ans ;
}