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"
long long delivery(int N, int K, int L, int p[]) {
long n = N, k = K, l = L;
long teams[10000002];
teams[0] = 0;
for (long i = 1; i <= n; i++){
teams[i] = p[i];
}
teams[n+1] = l;
long long ans = 1000000000000000000;
for (long i = 0; i <= n; i++){
long long t = 0;
long j = i, count = 0;
while (j >= 0){
if (count == 0){
t += 2*teams[j];
count = k;
}
j--;
count--;
}
j = i+1;
count = 0;
while (j <= n){
if (count == 0){
t += 2*(l-teams[j]);
count = k;
}
j++;
count--;
}
if (t < ans){
ans = t;
}
}
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... |