# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
996448 | fryingduc | Boxes with souvenirs (IOI15_boxes) | C++17 | 4 ms | 604 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 "bits/stdc++.h"
#include "boxes.h"
using namespace std;
const int maxn = 1e7 + 7;
long long fcw[maxn], fccw[maxn];
long long delivery(int n, int k, int l, int pos[]) {
for(int i = 1; i <= n; ++i) {
fcw[i] = fcw[max(0, i - k)] + pos[i] + min(pos[i], l - pos[i]);
}
for(int i = n; i; --i) {
fccw[i] = fccw[min(n + 1, i + k)] + (l - pos[i]) + min(pos[i], l - pos[i]);
}
long long ans = 1e18;
for(int i = 1; i <= n; ++i) {
ans = min(ans, fccw[i] + fcw[i] - min(pos[i], l - pos[i]));
}
cout << 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... |