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 <iostream>
#define INF 5'000'000'000'000'000'000
#define MIN(a, b) ((a) < (b) ? (a) : (b))
typedef long long ll;
ll delivery(int N, int K, int L, int p[])
{
ll best = INF;
for (ll i = 0; i < K; ++i)
{
ll sum = MIN(0, L - 2*p[0]) + MIN(L, 2*p[i]);
ll pos = i;
while (pos < N-1)
sum += MIN(L - (p[pos+1]<<1), 0),
pos = MIN(pos+K, N-1),
sum += MIN(L, p[pos]<<1);
best = MIN(best, sum);
}
return best;
}
# | 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... |