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;
#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#include "gap.h"
//#define int long long
template <class F, class _S>
bool chmin(F &u, const _S &v){
bool flag = false;
if ( u > v ){
u = v; flag |= true;
}
return flag;
}
template <class F, class _S>
bool chmax(F &u, const _S &v){
bool flag = false;
if ( u < v ){
u = v; flag |= true;
}
return flag;
}
long long findGap(int t, int n)
{
//if(t == 1){
int ans = 0;
long long l = 0, r = 1e18;
vector<int> a;
while(l <= r){
long long lf, rf;
MinMax(l, r, &lf, &rf);
if(lf == -1)break;
a.pb(lf); a.pb(rf);
l = lf+1;
r = rf-1;
}
sort(all(a));
for(int i = 1; i < (int)a.size(); i++){
chmax(ans, a[i] - a[i-1]);
}
//for(int i:a)cout << i << ' ';
//cout << '\n';
return ans;
//}
//return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |