# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
139987 | TAMREF | Boxes with souvenirs (IOI15_boxes) | C++11 | 2 ms | 376 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 "boxes.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll *ds, *de;
ll delivery(int N, int K, int L, int p[]) {
int s = 0, e = N - 1, k = K;
while(s <= e && p[s] == 0) ++s;
ds = new ll[N+1];
de = new ll[N+1];
if(s > e) return 0;
ll t = LLONG_MAX;
int si = s;
e = s;
for(int i = N; i--;){
de[i] = L - p[i];
if(i + k < N) de[i] += de[i+k];
}
for(; s < N; s++){
ds[s] = p[s];
if(s >= k) ds[s] += ds[s-k];
while(e+1 < N && ll(e-s+k-1)/k * L + 2ll * de[e+1] > ll(e-s+k)/k * L + 2ll * de[e+2]) ++e;
t = min(t, 2ll * (ds[s] + de[e+1]) + ll(e-s+k-1)/k * L);
}
return t;
}
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... |