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;
const ll MX = 1e7 + 5;
ll D[MX], E[MX];
ll delivery(int N, int K, int L, int *P) {
for (int i=1; i<=N; i++) D[i]=(i>K?D[i-K]:0)+P[i]+min(P[i], L-P[i]);
for (int i=N; i>=1; i--) E[i]=(i<=N-K?E[i+K]:0)+(L-P[i])+min(P[i], L-P[i]);
ll A=1e18;
for (int i=0; i<=N; i++) A=min(A, D[i]+E[i+1]);
return A;
}
# | 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... |