# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
238737 | nicolaalexandra | 선물상자 (IOI15_boxes) | C++14 | 964 ms | 399424 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "boxes.h"
#define DIM 10000010
#define INF 2000000000000000000LL
using namespace std;
long long dist_left[DIM],dist_right[DIM],dp_left[DIM],dp_right[DIM];
long long delivery (int n, int k, int l, int v[]){
int i, j, poz, poz2, last = -1;
long long sol = INF;
for (i=0;i<n;i++){
dist_left[i] = v[i];
dist_right[i] = l - v[i];
}
/// dp_left[i] - costul sa ajung la pozitia i
for (i=0;i<n;i++){
if (i < k)
dp_left[i] = v[i] + min (dist_left[i],dist_right[i]);
else dp_left[i] = dp_left[i-k] + v[i] + min (dist_left[i],dist_right[i]);
}
for (i=n-1;i>=0;i--){
if (i >= n-k){
dp_right[i] = dist_right[i] + min (dist_left[i],dist_right[i]);
} else dp_right[i] = dp_right[i+k] + dist_right[i] + min (dist_left[i],dist_right[i]);
}
for (i=-1;i<n;i++){
long long val = 0;
if (val >= 0)
val += dp_left[i];
if (i < n-1)
val += dp_right[i+1];
sol = min (sol,val);
}
return sol;
}
컴파일 시 표준 에러 (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... |