# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
370652 | Bill_00 | 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>
#define N 100005
typedef long long ll;
using namespace std;
ll a[N];
long long findGap(int T, int n)
{
ll m1=0,m2=1e18,ans=0;
if(T==1){
for(int i=1;i<=(n+1)/2;i++){
MinMax(m1,m2,&mn,&mx);
a[i]=mn;
a[n+1-i]=mx;
m1=mn+1;
m2=mx-1;
}
for(int i=1;i<n;i++){
ans=max(ans,a[i+1]-a[i]);
}
return ans;
}
return 0;
}