Submission #1027402

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