제출 #123670

#제출 시각아이디문제언어결과실행 시간메모리
123670dragonslayerit선물상자 (IOI15_boxes)C++14
70 / 100
852 ms432748 KiB
#include "boxes.h" #include <algorithm> #include <cstdio> long long prefix[10000000]; long long suffix[10000000]; long long delivery(int N, int K, int L, int p[]) { for(int i=1;i<=N;i++){ prefix[i]=((i>=K)?prefix[i-K]:0)+2*p[i-1]; } for(int i=N;i>=1;i--){ suffix[i]=((i+K<=N+1)?suffix[i+K]:0)+2*(L-p[i-1]); } long long ans=1e18; for(int i=1;i<=N+1;i++){ ans=std::min(ans,prefix[i-1]+suffix[i]); } for(int i=1;i+K<=N+1;i++){ ans=std::min(ans,prefix[i-1]+suffix[i+K]+L); } 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...