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;
ll n, k, l, data[10000010], lef[10000010], righ[10000010], ans;
long long delivery(int N, int K, int L, int p[]) {
n=N, k=K, l=L;
for(int i=0; i<n; i++) data[i+1]=p[i];
for(ll i=1; i<=n; i++){
lef[i]=min(l, (data[i]*2));
if(i>k) lef[i]+=lef[i-k];
}
for(ll i=n; i>0; i--){
righ[i]=min(l, (l-data[i])*2);
righ[i]+=righ[i+k];
}
ans=min(lef[n], righ[1]);
for(ll i=1; i<n; i++) ans=min(ans, lef[i]+righ[i+1]);
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... |