# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1011654 | ezzzay | Gap (APIO16_gap) | C++14 | 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 ll long long
#define pb push_back
const int MN=2e6;
ll arr[MN];
long long findGap(int T, int N){
int l=0,r=N-1;
ll s=0,t=1e18;
while(1){
ll &mn,&mx;
MinMax(s,t,mn,mx);
arr[l]=mn;
arr[r]=mx;
l++;
r--;
if(l+1==r or l==r)break;
}
ll ans=0;
for(int i=1;i<N;i++){
ans=max(ans,arr[i]-arr[i-1]);
}
return ans;
}