# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
23350 | Hassoony | Gap (APIO16_gap) | C++11 | 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<bits/stdc++.h>
#define MEM(dp,i) memset(dp,i,sizeof(dp))
#define R return
#define F first
#define S second
#define C continue
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const int MX=5009;
const ll mod=1e9+7;
const ll inf=(1ll<<60);
ll a[MX];
int findGap(int t,int n){
ll x=0,y=1e18,mn=-1,mx=-1,i=0;
MinMax(x,y,&mn,&mx);
while(mn!=-1&&mx!=-1&&i<(n+1)/2){
a[i]=mn;
a[n-i-1]=mx;
MinMax(mn,mx,&mn,&mx);
i++;
}
sort(a,a+n);
ll ans=0;
for(int i=0;i<n-1;i++){
ans=max(ans,a[i+1]-a[i]);
}
R ans;
}