# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
105735 | 2019-04-14T09:00:04 Z | Pro_ktmr | Gap (APIO16_gap) | C++14 | 0 ms | 0 KB |
#include"bits/stdc++.h" using namespace std; #define LL long long #define REP(i, n) for(int (i)=0; (i)<(n); (i)++) #define PB push_back #define MP make_pair #define MOD 1000000007 //MinMax(LL s, LL t, LL& mn, LL& mx) //aiのうちs以上の最小の数がmnに、aiのうちt以下の最大値がmxに格納される //aiの差分のうち最大のものを返す LL findGap(int T, int N){ LL m = 0LL; LL M = 1000000000000000000LL; vector<LL> v; for(int i=0; i<(N+1)/2; i++){ LL tmp1, tmp2; MinMax(m, M, tmp1, tmp2); v.PB(tmp1); v.PB(tmp2); m = tmp1+1; M = tmp2-1; } sort(v.begin(), v.end()); LL ans = 0; for(int i=1; i<v.size(); i++){ ans = max(ans, v[i] - v[i-1]); } return ans; }