# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
117500 | zubec | Boxes with souvenirs (IOI15_boxes) | C++14 | 551 ms | 221148 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;
const int N = 10000005;
long long dp[N], dp2[N];
long long delivery(int N, int K, int L, int p[]) {
int mid = L/2;
int lstPos = -1;
for (int i = 1; i <= N; i++){
int pos = p[i-1];
dp[i] = dp[max(0, i-K)] + min(L, pos*2);
}
long long ans = 1e18;
for (int i = N; i >= 1; i--){
int pos = p[i-1];
dp2[i] = dp2[min(N+1, i+K)] + min(L, (L-pos)*2);
ans = min(ans, dp[i]+dp2[i+1]);
}
ans = min(ans, dp[0]+dp2[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... |