제출 #406309

#제출 시각아이디문제언어결과실행 시간메모리
406309jk410선물상자 (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...