# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
392461 | my99n | Boxes with souvenirs (IOI15_boxes) | C++14 | 1 ms | 332 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;
long long cwtour[1000100], cwwtour[1000100];
long long delivery(int N, int K, int L, int p[]) {
int dis = 0;
for (int i = 1; i <= N; i++) cwtour[i] = p[i-1] + cwtour[max(0,i-K)];
for (int i = N; i >= 1; i--) cwwtour[i] = L-p[i-1] + cwwtour[i+K>N?0:i+K];
long long ans = 1e18;
for (int i = 1; i <= N; i++) {
if (i+1 <= N)
ans = min(ans, 2*cwtour[i]+2*cwwtour[i+1]);
if (i+K+1 <= N)
ans = min(ans, 2*cwtour[i]+2*cwwtour[i+K+1]+L);
}
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... |