# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
106760 | 2019-04-20T10:19:33 Z | brcode | Gap (APIO16_gap) | C++14 | 0 ms | 0 KB |
#include <iostream> #include "gap.h" using namespace std; const int MAXN = 1e6+5; long long arr[MAXN]; long long findgap(long long T,long long N){ long long a = 1; long long b = 1e18; long long l = 0; long long r = N-1; long long mn,mx; long long total = 0; while(total<N){ MinMax(a, b, &mn, &mx); arr[l] = mn; arr[r] = mx; l++; r--; total+=2; a = mn+1; b = mx-1; } long long diff = 0; for(long long i=0;i<N-1;i++){ diff = max(diff,arr[i+1]-arr[i]); } return diff; }