#include "boxes.h"
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define sol (k+k)
#define sag (k+k+1)
#define orta ((bas+son)/2)
#define coc g[node][i]
#define mod 1000000007
#define inf 1000000009
#define N 1000005
using namespace std;
typedef long long ll;
typedef pair < int , int > ii;
ll cvp, bas[N], son[N];
ll delivery(int n, int k, int l, int p[]) {
for(int i = 0; i < n; i++)
bas[i] = (i - k >= 0) ? bas[i - k] + p[i]*2ll : p[i]*2ll;
for(int i = n - 1; i >= 0; i--)
son[i] = (n > k + i) ? son[i + k] + (l - p[i])*2ll : (l - p[i])*2ll;
cvp = son[0];
for(int i = -1; i < n; i++)
for(int j = i + 1; j <= n; j++)
cvp = min(cvp, ((i>=0)?bas[i]:0ll) + son[j] + 1ll*(j - i - 1 + k - 1)/k*l);
return cvp;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
9 ms |
376 KB |
Output is correct |
3 |
Correct |
9 ms |
376 KB |
Output is correct |
4 |
Correct |
9 ms |
376 KB |
Output is correct |
5 |
Correct |
9 ms |
440 KB |
Output is correct |
6 |
Correct |
9 ms |
376 KB |
Output is correct |
7 |
Correct |
10 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
376 KB |
Output is correct |
2 |
Correct |
9 ms |
376 KB |
Output is correct |
3 |
Correct |
9 ms |
376 KB |
Output is correct |
4 |
Correct |
9 ms |
380 KB |
Output is correct |
5 |
Correct |
9 ms |
376 KB |
Output is correct |
6 |
Correct |
9 ms |
376 KB |
Output is correct |
7 |
Correct |
9 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
256 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 |
420 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
420 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
9 ms |
376 KB |
Output is correct |
3 |
Correct |
9 ms |
376 KB |
Output is correct |
4 |
Correct |
9 ms |
376 KB |
Output is correct |
5 |
Correct |
9 ms |
440 KB |
Output is correct |
6 |
Correct |
9 ms |
376 KB |
Output is correct |
7 |
Correct |
10 ms |
376 KB |
Output is correct |
8 |
Correct |
9 ms |
376 KB |
Output is correct |
9 |
Correct |
9 ms |
376 KB |
Output is correct |
10 |
Correct |
9 ms |
376 KB |
Output is correct |
11 |
Correct |
9 ms |
380 KB |
Output is correct |
12 |
Correct |
9 ms |
376 KB |
Output is correct |
13 |
Correct |
9 ms |
376 KB |
Output is correct |
14 |
Correct |
9 ms |
376 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
256 KB |
Output is correct |
17 |
Correct |
2 ms |
256 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 |
420 KB |
Output is correct |
21 |
Correct |
2 ms |
376 KB |
Output is correct |
22 |
Correct |
2 ms |
420 KB |
Output is correct |
23 |
Correct |
9 ms |
504 KB |
Output is correct |
24 |
Correct |
9 ms |
376 KB |
Output is correct |
25 |
Correct |
9 ms |
376 KB |
Output is correct |
26 |
Correct |
9 ms |
376 KB |
Output is correct |
27 |
Correct |
9 ms |
376 KB |
Output is correct |
28 |
Correct |
9 ms |
376 KB |
Output is correct |
29 |
Correct |
9 ms |
376 KB |
Output is correct |
30 |
Correct |
9 ms |
376 KB |
Output is correct |
31 |
Correct |
9 ms |
376 KB |
Output is correct |
32 |
Correct |
9 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
9 ms |
376 KB |
Output is correct |
3 |
Correct |
9 ms |
376 KB |
Output is correct |
4 |
Correct |
9 ms |
376 KB |
Output is correct |
5 |
Correct |
9 ms |
440 KB |
Output is correct |
6 |
Correct |
9 ms |
376 KB |
Output is correct |
7 |
Correct |
10 ms |
376 KB |
Output is correct |
8 |
Correct |
9 ms |
376 KB |
Output is correct |
9 |
Correct |
9 ms |
376 KB |
Output is correct |
10 |
Correct |
9 ms |
376 KB |
Output is correct |
11 |
Correct |
9 ms |
380 KB |
Output is correct |
12 |
Correct |
9 ms |
376 KB |
Output is correct |
13 |
Correct |
9 ms |
376 KB |
Output is correct |
14 |
Correct |
9 ms |
376 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
256 KB |
Output is correct |
17 |
Correct |
2 ms |
256 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 |
420 KB |
Output is correct |
21 |
Correct |
2 ms |
376 KB |
Output is correct |
22 |
Correct |
2 ms |
420 KB |
Output is correct |
23 |
Correct |
9 ms |
504 KB |
Output is correct |
24 |
Correct |
9 ms |
376 KB |
Output is correct |
25 |
Correct |
9 ms |
376 KB |
Output is correct |
26 |
Correct |
9 ms |
376 KB |
Output is correct |
27 |
Correct |
9 ms |
376 KB |
Output is correct |
28 |
Correct |
9 ms |
376 KB |
Output is correct |
29 |
Correct |
9 ms |
376 KB |
Output is correct |
30 |
Correct |
9 ms |
376 KB |
Output is correct |
31 |
Correct |
9 ms |
376 KB |
Output is correct |
32 |
Correct |
9 ms |
376 KB |
Output is correct |
33 |
Execution timed out |
2045 ms |
29664 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
9 ms |
376 KB |
Output is correct |
3 |
Correct |
9 ms |
376 KB |
Output is correct |
4 |
Correct |
9 ms |
376 KB |
Output is correct |
5 |
Correct |
9 ms |
440 KB |
Output is correct |
6 |
Correct |
9 ms |
376 KB |
Output is correct |
7 |
Correct |
10 ms |
376 KB |
Output is correct |
8 |
Correct |
9 ms |
376 KB |
Output is correct |
9 |
Correct |
9 ms |
376 KB |
Output is correct |
10 |
Correct |
9 ms |
376 KB |
Output is correct |
11 |
Correct |
9 ms |
380 KB |
Output is correct |
12 |
Correct |
9 ms |
376 KB |
Output is correct |
13 |
Correct |
9 ms |
376 KB |
Output is correct |
14 |
Correct |
9 ms |
376 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
256 KB |
Output is correct |
17 |
Correct |
2 ms |
256 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 |
420 KB |
Output is correct |
21 |
Correct |
2 ms |
376 KB |
Output is correct |
22 |
Correct |
2 ms |
420 KB |
Output is correct |
23 |
Correct |
9 ms |
504 KB |
Output is correct |
24 |
Correct |
9 ms |
376 KB |
Output is correct |
25 |
Correct |
9 ms |
376 KB |
Output is correct |
26 |
Correct |
9 ms |
376 KB |
Output is correct |
27 |
Correct |
9 ms |
376 KB |
Output is correct |
28 |
Correct |
9 ms |
376 KB |
Output is correct |
29 |
Correct |
9 ms |
376 KB |
Output is correct |
30 |
Correct |
9 ms |
376 KB |
Output is correct |
31 |
Correct |
9 ms |
376 KB |
Output is correct |
32 |
Correct |
9 ms |
376 KB |
Output is correct |
33 |
Execution timed out |
2045 ms |
29664 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |