## Submission #712522

# Submission time Handle Problem Language Result Execution time Memory
712522 2023-03-19T01:44:57 Z Username4132 Boxes with souvenirs (IOI15_boxes) C++14
100 / 100
486 ms 254740 KB
```#include "boxes.h"
#include<iostream>
#include<algorithm>
using namespace std;
using ll = long long;
#define forn(i, n) for(int i=0; i<(int)n; ++i)

const int MAXN=10000010;
int le[MAXN], ri[MAXN], cnl=0, cnr=0;
ll dpl[MAXN], dpr[MAXN];

long long delivery(int N, int K, int L, int p[]) {

forn(i, N){
if(p[i]<=(L>>1)) le[cnl++]=p[i];
else ri[cnr++]=L-p[i];
}

reverse(ri, ri+cnr);

forn(i, cnl){
if(i<K) dpl[i]=le[i];
else dpl[i]=dpl[i-K]+le[i];
}
forn(i, cnr){
if(i<K) dpr[i]=ri[i];
else dpr[i]=dpr[i-K]+ri[i];
}

ll ans = ((cnl? dpl[cnl-1] : 0)+ (cnr? dpr[cnr-1] : 0))<<1;

forn(i, K+1){
int il=cnl-1-i, ir=cnr-1-K+i;
ans = min(ans, (((il<0? 0 : dpl[il]) + (ir<0? 0 : dpr[ir]))<<1) + L);
}

return ans;
}```

#### Subtask #1 10.0 / 10.0

# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct

#### Subtask #2 10.0 / 10.0

# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct

#### Subtask #3 15.0 / 15.0

# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 308 KB Output is correct
8 Correct 1 ms 212 KB Output is correct

#### Subtask #4 15.0 / 15.0

# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 308 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 308 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 308 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 212 KB Output is correct

#### Subtask #5 20.0 / 20.0

# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 308 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 308 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 308 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 50 ms 25576 KB Output is correct
34 Correct 17 ms 17888 KB Output is correct
35 Correct 19 ms 18360 KB Output is correct
36 Correct 51 ms 25676 KB Output is correct
37 Correct 50 ms 25708 KB Output is correct
38 Correct 49 ms 25656 KB Output is correct
39 Correct 49 ms 24176 KB Output is correct
40 Correct 23 ms 19516 KB Output is correct
41 Correct 49 ms 25800 KB Output is correct
42 Correct 26 ms 19856 KB Output is correct

#### Subtask #6 30.0 / 30.0

# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 308 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 308 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 308 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 50 ms 25576 KB Output is correct
34 Correct 17 ms 17888 KB Output is correct
35 Correct 19 ms 18360 KB Output is correct
36 Correct 51 ms 25676 KB Output is correct
37 Correct 50 ms 25708 KB Output is correct
38 Correct 49 ms 25656 KB Output is correct
39 Correct 49 ms 24176 KB Output is correct
40 Correct 23 ms 19516 KB Output is correct
41 Correct 49 ms 25800 KB Output is correct
42 Correct 26 ms 19856 KB Output is correct
43 Correct 486 ms 253608 KB Output is correct
44 Correct 151 ms 176396 KB Output is correct
45 Correct 186 ms 184188 KB Output is correct
46 Correct 477 ms 254700 KB Output is correct
47 Correct 466 ms 254664 KB Output is correct
48 Correct 478 ms 254740 KB Output is correct
49 Correct 413 ms 239520 KB Output is correct
50 Correct 214 ms 193228 KB Output is correct
51 Correct 472 ms 254728 KB Output is correct
52 Correct 240 ms 196004 KB Output is correct