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 <bits/stdc++.h>
#include "boxes.h"
using namespace std;
typedef long long ll;
const ll INF=1e18;
ll delivery(int N, int K, int L, int p[]){
ll Ans=INF;
ll D1[N],D2[N];
for (int i=0; i<N; i++)
D1[i]=(ll)(i-K>=0?D1[i-K]:0)+p[i]+min(p[i],L-p[i]);
for (int i=N-1; i>=0; i--)
D2[i]=(ll)(i+K<N?D2[i+K]:0)+L-p[i]+min(p[i],L-p[i]);
for (int i=0; i<=N; i++)
Ans=min(Ans,(i?D1[i-1]:0)+(i<N?D2[i]:0));
return Ans;
}
# | 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... |