# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
238737 | 2020-06-12T13:18:16 Z | nicolaalexandra | 선물상자 (IOI15_boxes) | C++14 | 964 ms | 399424 KB |
#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; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 6 ms | 440 KB | Output is correct |
4 | Correct | 5 ms | 416 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 6 ms | 432 KB | Output is correct |
7 | Correct | 5 ms | 416 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 6 ms | 436 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 7 ms | 384 KB | Output is correct |
6 | Correct | 7 ms | 384 KB | Output is correct |
7 | Correct | 6 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 6 ms | 384 KB | Output is correct |
3 | Correct | 6 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 6 ms | 308 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 6 ms | 384 KB | Output is correct |
8 | Correct | 7 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 6 ms | 440 KB | Output is correct |
4 | Correct | 5 ms | 416 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 6 ms | 432 KB | Output is correct |
7 | Correct | 5 ms | 416 KB | Output is correct |
8 | Correct | 6 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 6 ms | 436 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 7 ms | 384 KB | Output is correct |
13 | Correct | 7 ms | 384 KB | Output is correct |
14 | Correct | 6 ms | 384 KB | Output is correct |
15 | Correct | 5 ms | 384 KB | Output is correct |
16 | Correct | 6 ms | 384 KB | Output is correct |
17 | Correct | 6 ms | 384 KB | Output is correct |
18 | Correct | 5 ms | 384 KB | Output is correct |
19 | Correct | 6 ms | 308 KB | Output is correct |
20 | Correct | 5 ms | 384 KB | Output is correct |
21 | Correct | 6 ms | 384 KB | Output is correct |
22 | Correct | 7 ms | 384 KB | Output is correct |
23 | Correct | 6 ms | 384 KB | Output is correct |
24 | Correct | 5 ms | 384 KB | Output is correct |
25 | Correct | 5 ms | 384 KB | Output is correct |
26 | Correct | 6 ms | 432 KB | Output is correct |
27 | Correct | 6 ms | 384 KB | Output is correct |
28 | Correct | 6 ms | 384 KB | Output is correct |
29 | Correct | 6 ms | 384 KB | Output is correct |
30 | Correct | 6 ms | 384 KB | Output is correct |
31 | Correct | 6 ms | 384 KB | Output is correct |
32 | Correct | 6 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 6 ms | 440 KB | Output is correct |
4 | Correct | 5 ms | 416 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 6 ms | 432 KB | Output is correct |
7 | Correct | 5 ms | 416 KB | Output is correct |
8 | Correct | 6 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 6 ms | 436 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 7 ms | 384 KB | Output is correct |
13 | Correct | 7 ms | 384 KB | Output is correct |
14 | Correct | 6 ms | 384 KB | Output is correct |
15 | Correct | 5 ms | 384 KB | Output is correct |
16 | Correct | 6 ms | 384 KB | Output is correct |
17 | Correct | 6 ms | 384 KB | Output is correct |
18 | Correct | 5 ms | 384 KB | Output is correct |
19 | Correct | 6 ms | 308 KB | Output is correct |
20 | Correct | 5 ms | 384 KB | Output is correct |
21 | Correct | 6 ms | 384 KB | Output is correct |
22 | Correct | 7 ms | 384 KB | Output is correct |
23 | Correct | 6 ms | 384 KB | Output is correct |
24 | Correct | 5 ms | 384 KB | Output is correct |
25 | Correct | 5 ms | 384 KB | Output is correct |
26 | Correct | 6 ms | 432 KB | Output is correct |
27 | Correct | 6 ms | 384 KB | Output is correct |
28 | Correct | 6 ms | 384 KB | Output is correct |
29 | Correct | 6 ms | 384 KB | Output is correct |
30 | Correct | 6 ms | 384 KB | Output is correct |
31 | Correct | 6 ms | 384 KB | Output is correct |
32 | Correct | 6 ms | 384 KB | Output is correct |
33 | Correct | 85 ms | 36472 KB | Output is correct |
34 | Correct | 39 ms | 36088 KB | Output is correct |
35 | Correct | 48 ms | 36100 KB | Output is correct |
36 | Correct | 87 ms | 36088 KB | Output is correct |
37 | Correct | 89 ms | 36088 KB | Output is correct |
38 | Correct | 94 ms | 36136 KB | Output is correct |
39 | Correct | 84 ms | 36076 KB | Output is correct |
40 | Correct | 55 ms | 36064 KB | Output is correct |
41 | Correct | 76 ms | 36148 KB | Output is correct |
42 | Correct | 70 ms | 36064 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 6 ms | 440 KB | Output is correct |
4 | Correct | 5 ms | 416 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 6 ms | 432 KB | Output is correct |
7 | Correct | 5 ms | 416 KB | Output is correct |
8 | Correct | 6 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 6 ms | 436 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 7 ms | 384 KB | Output is correct |
13 | Correct | 7 ms | 384 KB | Output is correct |
14 | Correct | 6 ms | 384 KB | Output is correct |
15 | Correct | 5 ms | 384 KB | Output is correct |
16 | Correct | 6 ms | 384 KB | Output is correct |
17 | Correct | 6 ms | 384 KB | Output is correct |
18 | Correct | 5 ms | 384 KB | Output is correct |
19 | Correct | 6 ms | 308 KB | Output is correct |
20 | Correct | 5 ms | 384 KB | Output is correct |
21 | Correct | 6 ms | 384 KB | Output is correct |
22 | Correct | 7 ms | 384 KB | Output is correct |
23 | Correct | 6 ms | 384 KB | Output is correct |
24 | Correct | 5 ms | 384 KB | Output is correct |
25 | Correct | 5 ms | 384 KB | Output is correct |
26 | Correct | 6 ms | 432 KB | Output is correct |
27 | Correct | 6 ms | 384 KB | Output is correct |
28 | Correct | 6 ms | 384 KB | Output is correct |
29 | Correct | 6 ms | 384 KB | Output is correct |
30 | Correct | 6 ms | 384 KB | Output is correct |
31 | Correct | 6 ms | 384 KB | Output is correct |
32 | Correct | 6 ms | 384 KB | Output is correct |
33 | Correct | 85 ms | 36472 KB | Output is correct |
34 | Correct | 39 ms | 36088 KB | Output is correct |
35 | Correct | 48 ms | 36100 KB | Output is correct |
36 | Correct | 87 ms | 36088 KB | Output is correct |
37 | Correct | 89 ms | 36088 KB | Output is correct |
38 | Correct | 94 ms | 36136 KB | Output is correct |
39 | Correct | 84 ms | 36076 KB | Output is correct |
40 | Correct | 55 ms | 36064 KB | Output is correct |
41 | Correct | 76 ms | 36148 KB | Output is correct |
42 | Correct | 70 ms | 36064 KB | Output is correct |
43 | Correct | 786 ms | 352592 KB | Output is correct |
44 | Correct | 477 ms | 354680 KB | Output is correct |
45 | Correct | 430 ms | 354784 KB | Output is correct |
46 | Correct | 874 ms | 396864 KB | Output is correct |
47 | Correct | 964 ms | 397068 KB | Output is correct |
48 | Correct | 871 ms | 397192 KB | Output is correct |
49 | Correct | 762 ms | 399424 KB | Output is correct |
50 | Correct | 423 ms | 364920 KB | Output is correct |
51 | Correct | 787 ms | 397832 KB | Output is correct |
52 | Correct | 476 ms | 366324 KB | Output is correct |