Submission #213301

#TimeUsernameProblemLanguageResultExecution timeMemory
213301arman_ferdousBoxes with souvenirs (IOI15_boxes)C++14
35 / 100
5 ms512 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 1e7+10; int n, k; ll l; ll dp1[N], dp2[N]; long long delivery(int _n, int _k, int _l, int p[]) { n = _n, k = _k, l = _l; for(int i = 1; i <= n; i++) { dp1[i] = 2ll * p[i - 1] + (i - k ? dp1[i - k] : 0); dp2[i] = 2ll * (l - p[n - i]) + (i - k ? dp2[i - k] : 0); } ll ans = 1e18; for(int i = 0; i <= n; i++) { ans = min(ans, dp1[i] + dp2[n - i]); if(n - i - k >= 0) ans = min(ans, dp1[i] + dp2[n - i - k] + l); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...