Submission #406309

#TimeUsernameProblemLanguageResultExecution timeMemory
406309jk410Boxes with souvenirs (IOI15_boxes)C++17
100 / 100
556 ms207044 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; typedef long long ll; const ll INF=1e18; ll delivery(int N, int K, int L, int p[]){ ll Ans=INF; ll D1[N],D2[N]; for (int i=0; i<N; i++) D1[i]=(ll)(i-K>=0?D1[i-K]:0)+p[i]+min(p[i],L-p[i]); for (int i=N-1; i>=0; i--) D2[i]=(ll)(i+K<N?D2[i+K]:0)+L-p[i]+min(p[i],L-p[i]); for (int i=0; i<=N; i++) Ans=min(Ans,(i?D1[i-1]:0)+(i<N?D2[i]:0)); return Ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...