# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
624883 | brucecccccc | Boxes with souvenirs (IOI15_boxes) | C++14 | 1 ms | 308 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;
ll delivery(int N, int K, int L, int p[]) {
vector<ll> forward(N), backward(N);
int i = 0;
while (i < N && forward[i] == 0) {
forward[i] = p[i] * 2;
for (int j = i + K; j < N; j += K) {
forward[j] = forward[j-K] + 2 * p[j];
}
i++;
}
i = N-1;
while (i >= 0 && backward[i] == 0) {
backward[i] = (L - p[i]) * 2;
for (int j = i - K; j >= 0; j -= K) {
backward[j] = backward[j+K] + 2 * (L - p[j]);
}
i--;
}
ll ans = min(forward[N-1], backward[0]);
for (int i = 0; i < N - 1; i++) {
ans = min(ans, forward[i] + backward[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... |