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;
const int MN=1e7+10;
long long dp[MN];
long long delivery(int n, int k, int l, int p[]) {
sort(p,p+n);
for(int i=0;i<n;i++){
dp[i]=min(2*p[i],l);
if(i-k>=0){
dp[i]+=dp[i-k];
}
}
long long ans=dp[n-1];
for(int i=n-1;i>=0;i--){
dp[i]=min(2*(l-p[i]),l);
if(i+k<n){
dp[i]+=dp[i+k];
}
if(i){
ans=min(ans,dp[i]+dp[i-1]);
}
else{
ans=min(ans,dp[i]);
}
}
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... |