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;
long long s1[10000005],s2[10000005];
long long delivery(int n, int k, int l, int poz[]) {
long long ans = -1;
for(int i = 1;i <= n;i++) {
if (i < k)
s1[i] = min(2 * poz[i - 1], l);
else
s1[i] = min(2 * poz[i - 1], l) + s1[i - k];
}
for (int i = n;i >= 1;i--) {
if (i > n - k + 1)
s2[i] = min(2 * (l - poz[i - 1]), l);
else
s2[i] = s2[i + k] + min(2 * (l - poz[i - 1]), l);
}
for (int i = 0;i <= n;i++) {
if (ans == -1)
ans = s1[i] + s2[i + 1];
ans = min(ans, s1[i] + s2[i + 1]);
}
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... |