## Submission #712520

# Submission time Handle Problem Language Result Execution time Memory
712520 2023-03-19T01:19:49 Z Username4132 Boxes with souvenirs (IOI15_boxes) C++14
10 / 100
1 ms 340 KB
```#include "boxes.h"
#include<iostream>
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];
}

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 1 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct

#### Subtask #2 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 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 Incorrect 1 ms 316 KB Output isn't correct
7 Halted 0 ms 0 KB -

#### Subtask #3 0 / 15.0

# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -

#### Subtask #4 0 / 15.0

# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 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 1 ms 340 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Incorrect 1 ms 316 KB Output isn't correct
14 Halted 0 ms 0 KB -

#### Subtask #5 0 / 20.0

# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 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 1 ms 340 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Incorrect 1 ms 316 KB Output isn't correct
14 Halted 0 ms 0 KB -

#### Subtask #6 0 / 30.0

# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 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 1 ms 340 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Incorrect 1 ms 316 KB Output isn't correct
14 Halted 0 ms 0 KB -