Submission #1027380

#TimeUsernameProblemLanguageResultExecution timeMemory
1027380MuhammetGap (APIO16_gap)C++17
30 / 100
37 ms4436 KiB
#include <bits/stdc++.h> #include "gap.h" #define ll long long #define sz(s) (int)s.size() using namespace std; long long findGap(int T, int n){ vector <ll> v, v1; for(int i = 0; i < (n+1)/2; i++){ ll s, t, mn, mx; if(i == 0) s = 0, t = 1e18; else s = v.back()+1, t = v1.back()-1; MinMax(s, t, &mn, &mx); v.push_back(mn); v1.push_back(mx); } if(v.back() == v1.back()) v1.pop_back(); while(sz(v1) > 0){ v.push_back(v1.back()); v1.pop_back(); } ll ans = 0; for(int i = 0; i < n-1; i++){ ans = max(ans, v[i+1]-v[i]); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...