| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 163017 | kostia244 | 선물상자 (IOI15_boxes) | C++14 | 2 ms | 380 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "boxes.h"
#include<bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using vi = vector<ll>;
ll n, k, l;
vi pos, dpl, dpr;
ll getl(ll x) {
return min(2ll*x, l);
}
ll getr(ll x) {
return min(2ll*(l-x), l);
}
long long delivery(int N, int K, int L, int P[]) {
n=N, k = K, l = L;
ll ans = LLONG_MAX;
pos.resize(n+2);
dpl.resize(n+2);
dpr.resize(n+2);
for(int i = 0; i < n; i++)
pos[i+1] = P[i];
ll p, cst;
p=cst=0;
for(int i = 1; i <= n; i++) {
cst += min(abs(p-pos[i]), l-abs(p-pos[i])), p = pos[i];
dpl[i] = cst+min(p,l-p);
if(i%k==0) {
cst += min(p,l-p);
p = 0;
}
}
ans = dpl[n], p = 0, cst = 0;
for(int i = n; i; i--) {
cst += min(abs(p-pos[i]), l-abs(p-pos[i])), p = pos[i];
dpr[i] = cst+min(p,l-p);
if((n-i+1)%k==0) {
cst += min(p,l-p);
p = 0;
}
ans = min(ans, dpr[i]+dpl[i-1]);
}
return ans;
}
컴파일 시 표준 에러 (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... | ||||
