This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "boxes.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll dp[10000000];
long long delivery(int n, int k, int l, int p[]) {
for(int i = 0; i < min(n, k); ++i) {
dp[i] = min({2*p[i], 2*(l-p[0]), l});
}
for(int i = k; i < n; ++i) {
dp[i] = dp[i-k] + min({2*p[i], 2*(l-p[i-k+1]), l});
}
ll res = 1ll << 60;
for(int i = max(0, n-k-1); i < n; ++i) {
res = min(res, dp[i] + min({2*p[n-1], 2*(l-p[i]), l}));
}
if(0) {
for(int i = 0; i < n; ++i) {
cout << dp[i] << ' ';
}
cout << '\n';
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |