# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
619414 | Hazem | Boxes with souvenirs (IOI15_boxes) | C++14 | 1 ms | 340 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 <bits/stdc++.h>
#define LL long long
using namespace std;
const LL LINF = 1e18;
LL a[10000010],pr[10000010],su[10000010];
vector<LL>vec[2];
LL n,k,L1;
long long delivery(int N, int K, int L, int p[]) {
n = N,k = K;
L1 = L;
for(int i=1;i<=n;i++)
a[i] = p[i-1];
for(int i=1;i<=n;i++)
if(i<=k)
pr[i] = a[i]*2;
else
pr[i] = pr[i-k] + a[i]*2;
for(int i=n;i>=1;i--)
if(n-i+1<=k)
su[i] = (L-a[i])*2;
else
su[i] = su[i+k] + (L-a[i])*2;
LL ans = min(pr[n],su[1]);
for(int i=1;i<=n;i++)
ans = min(ans,pr[i-1]+su[i+k]+L);
return ans;
}
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... |