# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
728431 | AndrijaM | Boxes with souvenirs (IOI15_boxes) | C++14 | 0 ms | 0 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>
using namespace std;
const long long maxn=2e5+10;
long long delivery(long long n, long long K, long long l, long long p[])
{
long long ans=0;
long long k=K;
for(long long i=0;i<n;i++)
{
if(k==0)
{
k=K;
ans+=min(2*p[i-1],l);
}
k--;
}
if(k!=0)
ans+=min(2*p[n-1],l);
return ans;
}