# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
218691 | alexandra_udristoiu | Boxes with souvenirs (IOI15_boxes) | C++14 | 8 ms | 384 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 = n; i >= 1; i--){
p[i] = p[i - 1];
}
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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |