Submission #403037

#TimeUsernameProblemLanguageResultExecution timeMemory
403037CursedCodeGap (APIO16_gap)C++14
30 / 100
51 ms2360 KiB
#include "gap.h" #include <bits/stdc++.h> #define pb push_back #define sz(v) ((int)(v).size()) #define all(v) (v).begin(), (v).end() using namespace std; typedef long long lld; lld findGap(int T, int N) { if (T == 1){ lld p = 0, q = (lld)1e18 + 1; vector <lld> arr; for (;;){ lld mn, mx; MinMax(p+1, q-1, &mn, &mx); arr.pb(mn); arr.pb(mx); if (mn == mx || sz(arr) == N) break; p = mn, q = mx; } sort(all(arr)); lld ans = 0; for (int i=1;i<sz(arr);i++) ans = max(ans, arr[i]-arr[i-1]); return ans; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...