# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
218693 | alexandra_udristoiu | Boxes with souvenirs (IOI15_boxes) | C++14 | 500 ms | 172536 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];
static int v[10000005];
long long delivery(int n, int k, int lg, int p[]) {
int i, u;
long long sol;
for(i = 1; i <= n; i++){
v[i] = p[i - 1];
}
for(i = 1; i <= n; i++){
if(v[i] > lg - v[i]){
u = i - 1;
break;
}
if(i <= k){
d[i] = 2 * v[i];
}
else{
d[i] = 2 * v[i] + d[i - k];
}
}
for(i = n; i > u; i--){
if(i + k > n){
d[i] = 2 * (lg - v[i]);
}
else{
d[i] = 2 * (lg - v[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... |