제출 #602577

#제출 시각아이디문제언어결과실행 시간메모리
602577daisy2선물상자 (IOI15_boxes)C++14
0 / 100
1 ms340 KiB
#include<iostream> #include "boxes.h" using namespace std; #define MAX 100000000000000000 long long maone[10000005],maoneri[10000005],maonele[10000005]; long long delivery(int N, int k, int L, int p[]) { long long ans=MAX; for(int i=1;i<=N;i++) maonele[i]=maonele[max(0,i-k)]+2*p[i-1]; for(int i=N;i>=1;i--){ maoneri[i]=maoneri[min(N+1,i+k)]+2*(L-p[i-1]); } for(int i=1;i<=N;i++) { maone[i]=min(maonele[i],maoneri[i]); ans=min(ans,maonele[i-1]+maoneri[i]); } for(int i=1;i<=N;i++) { ans=min(ans,maone[max(0,i-k)]+maone[i+1]+2*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...