Submission #928571

#TimeUsernameProblemLanguageResultExecution timeMemory
928571OAleksaBoxes with souvenirs (IOI15_boxes)C++14
100 / 100
420 ms245268 KiB
#include "boxes.h" #include <bits/stdc++.h> #define f first #define s second using namespace std; const int N = 1e7 + 69; long long dp1[N], dp2[N]; long long delivery(int n, int k, int l, int a[]) { for (int i = 1;i <= n;i++) dp1[i] = dp1[max(0, i - k)] + min(l, 2 * a[i - 1]); for (int i = n;i >= 1;i--) dp2[i] = dp2[min(n + 1, i + k)] + min(l, 2 * (l - a[i - 1])); long long ans = min(dp1[n], dp2[1]); for (int i = 1; i < n;i++) ans = min(ans, dp1[i] + dp2[i + 1]); return ans; } /* 3 2 8 1 2 5 */
#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...