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 <algorithm>
#define M 10000000
using namespace std;
long long d[2][M+1];
long long delivery(int N, int K, int L, int p[]) {
sort(p,p+N);
for(int i=0;i<N;i++) d[0][i]=(i>=K ? d[0][i-K] : 0ll)+min(p[i]*2,L);
for(int i=N-1;i>=0;i--) d[1][i]=(i+K<N ? d[1][i+K] : 0ll)+min((L-p[i])*2,L);
long long mn=min(d[0][N-1],d[1][0]);
for(int i=1;i<N;i++) mn=min(mn,d[0][i-1]+d[1][i]);
return mn;
}
# | 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... |