Submission #27443

# Submission time Handle Problem Language Result Execution time Memory
27443 2017-07-12T15:34:11 Z zoomswk Boxes with souvenirs (IOI15_boxes) C++14
100 / 100
774 ms 235292 KB
#include "boxes.h"
#include <bits/stdc++.h>
using namespace std;

long long suff[10000005];
long long pre[10000005];
int pp[10000005];

long long delivery(int N, int K, int L, int p[]){
    for(int i=N; i>=1; i--) pp[i] = p[i-1];
    for(int i=1; i<=K; i++) pre[i] = 2*pp[i];
    for(int i=K+1; i<=N; i++) pre[i] = 2*pp[i] + pre[i-K];
    for(int i=1; i<=K; i++) suff[N-i+1] = 2*(L-pp[N-i+1]);
    for(int i=N-K; i>=1; i--) suff[i] = 2*(L-pp[i]) + suff[i+K];
    long long res = 1e18;
    for(int i=0; i<K; i++){
        long long minv = pre[0];
        for(int j=i; j<=N; j+=K){
            minv += L;
            minv = min(minv, pre[j]);
            res = min(res, suff[j+1]+minv);
        }
    }
    return res;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 292 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 380 KB Output is correct
17 Correct 2 ms 292 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 348 KB Output is correct
25 Correct 2 ms 376 KB Output is correct
26 Correct 2 ms 380 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 376 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 2 ms 504 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 380 KB Output is correct
17 Correct 2 ms 292 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 348 KB Output is correct
25 Correct 2 ms 376 KB Output is correct
26 Correct 2 ms 380 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 376 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 2 ms 504 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 2 ms 376 KB Output is correct
33 Correct 55 ms 23876 KB Output is correct
34 Correct 33 ms 23752 KB Output is correct
35 Correct 31 ms 23800 KB Output is correct
36 Correct 58 ms 23772 KB Output is correct
37 Correct 67 ms 23772 KB Output is correct
38 Correct 66 ms 23800 KB Output is correct
39 Correct 52 ms 23788 KB Output is correct
40 Correct 40 ms 23788 KB Output is correct
41 Correct 66 ms 23852 KB Output is correct
42 Correct 46 ms 23808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 380 KB Output is correct
17 Correct 2 ms 292 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 348 KB Output is correct
25 Correct 2 ms 376 KB Output is correct
26 Correct 2 ms 380 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 376 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 2 ms 504 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 2 ms 376 KB Output is correct
33 Correct 55 ms 23876 KB Output is correct
34 Correct 33 ms 23752 KB Output is correct
35 Correct 31 ms 23800 KB Output is correct
36 Correct 58 ms 23772 KB Output is correct
37 Correct 67 ms 23772 KB Output is correct
38 Correct 66 ms 23800 KB Output is correct
39 Correct 52 ms 23788 KB Output is correct
40 Correct 40 ms 23788 KB Output is correct
41 Correct 66 ms 23852 KB Output is correct
42 Correct 46 ms 23808 KB Output is correct
43 Correct 544 ms 235104 KB Output is correct
44 Correct 322 ms 235160 KB Output is correct
45 Correct 381 ms 235144 KB Output is correct
46 Correct 538 ms 235144 KB Output is correct
47 Correct 567 ms 235240 KB Output is correct
48 Correct 774 ms 235208 KB Output is correct
49 Correct 502 ms 235192 KB Output is correct
50 Correct 390 ms 235292 KB Output is correct
51 Correct 572 ms 235104 KB Output is correct
52 Correct 390 ms 235096 KB Output is correct