# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
68409 | zetapi | Boxes with souvenirs (IOI15_boxes) | C++14 | 2 ms | 424 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;
#define pb push_back
#define mp make_pair
#define ll long long
#define itr ::iterator
const int MAX=1e5;
ll N,K,L,cost[MAX],rev[MAX];
long long delivery(int N_,int K_, int L_,int P[])
{
N=N_;
K=K_;
L=L_;
for(int A=0;A<N;A+=K)
for(int B=A;B<A+K and B<N;B++)
cost[B]=min(L,2*1ll*P[B])+(A==0?0:cost[A-1]);
for(int A=N-1;A>=0;A-=K)
for(int B=A;B>A-K and B>=0;B--)
rev[B]=min(L,2*(L-1ll*P[B]))+rev[A+1];
ll res=rev[0];
for(int A=0;A<N;A++)
res=min(res,cost[A]+rev[A+1]);
return res;
}
/*int main()
{
ios_base::sync_with_stdio(false);
int P[]={1,2,5};
cout<<delivery(3,2,8,P)<<"\n";
return 0;
}*/
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... |