# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
218687 | 2020-04-02T14:04:36 Z | alexandra_udristoiu | Boxes with souvenirs (IOI15_boxes) | C++14 | 5 ms | 384 KB |
#include<iostream> #include "boxes.h" using namespace std; static long long d[10000005]; long long delivery(int n, int k, int lg, int p[]) { int i, u; long long sol; for(i = 1; i <= n; i++){ if(p[i] > lg - p[i]){ u = i - 1; break; } if(i <= k){ d[i] = 2 * p[i]; } else{ d[i] = 2 * p[i] + d[i - k]; } } for(i = n; i > u; i--){ if(i + k > n){ d[i] = 2 * (lg - p[i]); } else{ d[i] = 2 * (lg - p[i]) + d[i + k]; } } sol = d[u] + d[u + 1]; for(i = u; i >= 1 && i > u - k; i--){ sol = min(sol, lg + d[i - 1] + d[ min(i + k, n + 1) ]); } return sol; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Incorrect | 5 ms | 384 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |