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;
long long a,b,c,d,e,i,j,ii,jj,zx,xc,pr[10000009],sf[10000009],pas,f[10000009];
long long delivery(int N, int K, int L, int p[]) {
for(i=N; i>=1; i--) f[i]=p[i-1];
for(i=1; i<=N; i++){
if(f[i]<=L-f[i]){
if(i>=K) j=i-K; else j=0;
pr[i]=f[i]*2+pr[j];
}else{
if(i>=K) j=i-K; else j=0;
pr[i]=L+pr[j];
}
//cout<<pr[i]<<" ";
}
//cout<<endl;
//
for(i=N; i>=1; i--){
if(f[i]==0) break;
if(L-f[i]<=f[i]){
if(i+K>N) j=N+1; else j=i+K;
sf[i]=(L-f[i])*2+sf[j];
}else{
if(i+K>N) j=N+1; else j=i+K;
sf[i]=L+sf[j];
}
}
pas=999999999999999999LL;
for(i=1; i<=N; i++){
if(i!=N&&f[i+1]==0) continue;
pas=min(pas,pr[i]+sf[i+1]);
}
return pas;
}
# | 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... |