| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1359695 | waygonz | 선물상자 (IOI15_boxes) | C++20 | 1 ms | 344 KiB |
#include "boxes.h"
#include <bits/stdc++.h>
#define ll long long
using namespace std;
long long delivery(int N, int K, int L, int p[]) {
vector<ll> a(N+2), pfx(N+2), sfx(N+2);
for (int i = 1; i <= N; i++) a[i] = p[i-1];
for (int i = 1; i <= N; i++) {
pfx[i] = 2LL * a[i];
if (i > K) pfx[i] += pfx[i-K];
}
for (int i = N; i > 0; i--) {
sfx[i] = 2LL * (L - a[i]);
if (i + K <= N) sfx[i] += sfx[i+K];
}
ll ans = min(pfx[N], sfx[1]);
for (int i = 1; i <= N; i++) {
ans = min(ans, pfx[i] + sfx[i+1]);
ans = min(ans, pfx[i] + sfx[min(N+1, i+K+1)] + L);
}
return ans;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
