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;
typedef long long int64;
const int maxn = 1e7 + 2;
int64 l[maxn], r[maxn];
long long delivery(int n, int k, int m, int p[]) {
for (int i = 1; i <= n; i++){
l[i] = l[(i - 1) / k * k] + min(p[i-1] * 2, m);
}
reverse(p, p + n);
for (int i = 1; i <= n; i++){
r[i] = r[(i - 1) / k * k] + min((m - p[i-1]) * 2, m);
// cout << i << " " << r[i] << "\n";
}
int64 rs = 1e18;
for (int64 i = 1; i <= n; i++){
// cout << i << " " << l[i] << " " << r[n - i] << "\n";
rs = min(rs, l[i] + r[n - i]);
}
return rs;
}
# | 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... |