# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
39606 | 2018-01-16T17:48:52 Z | igzi | Gap (APIO16_gap) | C++11 | 0 ms | 0 KB |
#include <bits/stdc++.h> //#include "gap.h" using namespace std; long long findGap(int t,int n){ long long l=0,d=n+1,a[100005],m=0,i; for(i=0;i<n;i++){ a[i]=-5; } a[0]=-1; a[n+1]=1000000000000000005; for(i=1;i<=(n+1)/2;i++){ MinMax(a[l]+1,a[d]-1,&a[l+1],&a[d-1]); l++; d--; } for(i=2;i<=l;i++){ m=max(m,a[i]-a[i-1]); } for(i=d+1;i<n+1;i++){ m=max(m,a[i]-a[i-1]); } return m; }