Submission #715381

#TimeUsernameProblemLanguageResultExecution timeMemory
715381studyGap (APIO16_gap)C++17
0 / 100
50 ms2320 KiB
#include <bits/stdc++.h> #include "gap.h" using ll = long long; using namespace std; long long findGap(int T, int N){ ll pmini = -1, pmaxi = 1e18+1; vector<ll> ans; for (int i=0; i<(N+1)/2; ++i){ long long a,b; MinMax(pmini+1,pmaxi-1,&a,&b); if (a != -1) ans.emplace_back(a); if (b != -1 and a != b) ans.emplace_back(b); if (a != -1) pmini = a; if (b != -1) pmaxi = b; if (a >= b) return 0; } sort(ans.begin(),ans.end()); ll res = 0; for (int i=1; i<N; ++i){ res = max(res,ans[i]-ans[i-1]); } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...