Submission #93475

# Submission time Handle Problem Language Result Execution time Memory
93475 2019-01-08T17:23:43 Z tincamatei Boxes with souvenirs (IOI15_boxes) C++14
50 / 100
35 ms 4216 KB
#include <bits/stdc++.h>
#include "boxes.h"

const int MAX_N = 1000;

long long pref[1+MAX_N], suff[1+MAX_N];

long long delivery(int n, int k, int l, int p[]) {
  long long rez = 1LL << 60;

  if(n > 1000)
    return 0LL;

  for(int i = 1; i <= n; ++i) {
    if(i - k >= 0)
      pref[i] = pref[i - k];
    pref[i] = pref[i] + p[i - 1] * 2;
  }

  for(int i = 1; i <= n; ++i) {
    if(i - k >= 0)
      suff[i] = suff[i - k];
    suff[i] = suff[i] + (l - p[n - i]) * 2;
  }

  for(int i = 0; i <= n; ++i)
    for(int j = 0; j <= n - i; ++j)
      rez = std::min(rez, pref[i] + suff[j] + (long long)(n - i - j + k - 1) / k * l);

  return rez;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 292 KB Output is correct
2 Correct 8 ms 376 KB Output is correct
3 Correct 8 ms 296 KB Output is correct
4 Correct 7 ms 380 KB Output is correct
5 Correct 8 ms 344 KB Output is correct
6 Correct 7 ms 376 KB Output is correct
7 Correct 7 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 384 KB Output is correct
2 Correct 10 ms 376 KB Output is correct
3 Correct 7 ms 376 KB Output is correct
4 Correct 8 ms 376 KB Output is correct
5 Correct 7 ms 376 KB Output is correct
6 Correct 7 ms 376 KB Output is correct
7 Correct 8 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 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 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 292 KB Output is correct
2 Correct 8 ms 376 KB Output is correct
3 Correct 8 ms 296 KB Output is correct
4 Correct 7 ms 380 KB Output is correct
5 Correct 8 ms 344 KB Output is correct
6 Correct 7 ms 376 KB Output is correct
7 Correct 7 ms 376 KB Output is correct
8 Correct 7 ms 384 KB Output is correct
9 Correct 10 ms 376 KB Output is correct
10 Correct 7 ms 376 KB Output is correct
11 Correct 8 ms 376 KB Output is correct
12 Correct 7 ms 376 KB Output is correct
13 Correct 7 ms 376 KB Output is correct
14 Correct 8 ms 376 KB Output is correct
15 Correct 2 ms 256 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 256 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 7 ms 376 KB Output is correct
24 Correct 7 ms 376 KB Output is correct
25 Correct 7 ms 380 KB Output is correct
26 Correct 7 ms 376 KB Output is correct
27 Correct 7 ms 376 KB Output is correct
28 Correct 7 ms 372 KB Output is correct
29 Correct 7 ms 376 KB Output is correct
30 Correct 7 ms 376 KB Output is correct
31 Correct 7 ms 376 KB Output is correct
32 Correct 7 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 292 KB Output is correct
2 Correct 8 ms 376 KB Output is correct
3 Correct 8 ms 296 KB Output is correct
4 Correct 7 ms 380 KB Output is correct
5 Correct 8 ms 344 KB Output is correct
6 Correct 7 ms 376 KB Output is correct
7 Correct 7 ms 376 KB Output is correct
8 Correct 7 ms 384 KB Output is correct
9 Correct 10 ms 376 KB Output is correct
10 Correct 7 ms 376 KB Output is correct
11 Correct 8 ms 376 KB Output is correct
12 Correct 7 ms 376 KB Output is correct
13 Correct 7 ms 376 KB Output is correct
14 Correct 8 ms 376 KB Output is correct
15 Correct 2 ms 256 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 256 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 7 ms 376 KB Output is correct
24 Correct 7 ms 376 KB Output is correct
25 Correct 7 ms 380 KB Output is correct
26 Correct 7 ms 376 KB Output is correct
27 Correct 7 ms 376 KB Output is correct
28 Correct 7 ms 372 KB Output is correct
29 Correct 7 ms 376 KB Output is correct
30 Correct 7 ms 376 KB Output is correct
31 Correct 7 ms 376 KB Output is correct
32 Correct 7 ms 376 KB Output is correct
33 Incorrect 35 ms 4216 KB Output isn't correct
34 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 292 KB Output is correct
2 Correct 8 ms 376 KB Output is correct
3 Correct 8 ms 296 KB Output is correct
4 Correct 7 ms 380 KB Output is correct
5 Correct 8 ms 344 KB Output is correct
6 Correct 7 ms 376 KB Output is correct
7 Correct 7 ms 376 KB Output is correct
8 Correct 7 ms 384 KB Output is correct
9 Correct 10 ms 376 KB Output is correct
10 Correct 7 ms 376 KB Output is correct
11 Correct 8 ms 376 KB Output is correct
12 Correct 7 ms 376 KB Output is correct
13 Correct 7 ms 376 KB Output is correct
14 Correct 8 ms 376 KB Output is correct
15 Correct 2 ms 256 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 256 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 7 ms 376 KB Output is correct
24 Correct 7 ms 376 KB Output is correct
25 Correct 7 ms 380 KB Output is correct
26 Correct 7 ms 376 KB Output is correct
27 Correct 7 ms 376 KB Output is correct
28 Correct 7 ms 372 KB Output is correct
29 Correct 7 ms 376 KB Output is correct
30 Correct 7 ms 376 KB Output is correct
31 Correct 7 ms 376 KB Output is correct
32 Correct 7 ms 376 KB Output is correct
33 Incorrect 35 ms 4216 KB Output isn't correct
34 Halted 0 ms 0 KB -