# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
71781 | zubec | Boxes with souvenirs (IOI15_boxes) | C++14 | 530 ms | 235208 KiB |
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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 10000010;
int n, k, l, a[N];
long long dp1[N], dp2[N];
long long delivery(int N, int K, int L, int p[]) {
ll ans = 1e15;
n = N;
k = K;
l = L;
for (int i = 1; i <= n; i++)
a[i] = p[i-1];
for (int i = 1; i <= n; i++){
int pre = max(0, i-k);
dp1[i] = dp1[pre] + min((ll)l, a[i]*1LL*2);
}
for (int i = n; i >= 1; i--){
int nxt = min(n+1, i+k);
dp2[i] = dp2[nxt] + min((ll)l, (l-a[i])*1LL*2);
}
for (int i = 0; i <= n; i++){
ans = min(ans, dp1[i]+dp2[i+1]);
}
return ans;
}
Compilation message (stderr)
# | 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... |