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>
#define ll long long
using namespace std;
ll delivery(int N, int K, int L, int p[]) {
ll pref[N];
ll suff[N];
ll x=K;
for(ll i=0;i<N;i++){
if(i<x){
pref[i]=min(L,p[i]*2);
}
else{
pref[i]=min(L,p[i]*2)+pref[i*x/x-1];
}
}
for(ll i=N-1;i>=0;i--){
if(N-i-1<x){
suff[i]=min(2*(L-p[i]),L);
}
else{
suff[i]=min(2*(L-p[i]),L)+suff[i*x/x+1];
}
}
ll res=min(pref[N-1],suff[0]);
for(int i=0;i<N-1;i++){
res=min(res,pref[i]+suff[i+1]);
}
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... |