| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1331689 | uranhishig | 선물상자 (IOI15_boxes) | C++20 | 1 ms | 348 KiB |
#include "boxes.h"
#include<bits/stdc++.h>
using namespace std;
// #define int long long
long long delivery(int n, int k, int l, int p[]) {
vector<long long> pre(n + 1, 0);
vector<long long> suf(n + 1, 0);
for (long long i = 0; i < n; i++) {
pre[i] = 2 * p[i];
if (i >= k) {
pre[i] += pre[i - k];
}
}
for (long long i = n - 1; i >= 0; i--) {
suf[i] = 2 * (l - p[i]);
if (i + k < n) {
suf[i] += suf[i + k];
}
}
long long ans = min(suf[0], pre[n - 1]);
if (n <= k) {
ans = min(ans, l * 1LL);
return ans;
}
for (long long i = 0; i < n; i++) {
ans = min(ans, pre[i] + suf[i + 1]);
}
for (long long i = 0; i < n; i++) {
long long idx = min((long long)n, i + k + 1);
ans = min(ans, l + pre[i] + suf[idx]);
}
return ans;
}| # | 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... | ||||
