| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1359692 | waygonz | 선물상자 (IOI15_boxes) | C++20 | 0 ms | 348 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+1), pfx(N+1), sfx(N+1);
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], pfx[N-K] + L);
for (int i = 1; i <= N; i++) {
if (i < N) ans = min(ans, pfx[i] + sfx[i+1]);
if (i + K < N) ans = min(ans, pfx[i] + sfx[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... | ||||
