제출 #1020080

#제출 시각아이디문제언어결과실행 시간메모리
1020080Andrey선물상자 (IOI15_boxes)C++14
100 / 100
432 ms293980 KiB
#include "boxes.h" #include<bits/stdc++.h> using namespace std; long long dp1[10000001]; long long dp2[10000001]; long long delivery(int n, int k, int l, int p[]) { dp1[0] = 0; dp2[n] = 0; for(int i = 1; i <= n; i++) { long long c = min(2*p[i-1],l); if(i < k) { dp1[i] = c; } else { dp1[i] = c+dp1[i-k]; } } long long ans = LLONG_MAX; for(int i = n-1; i >= 0; i--) { long long c = min(2*(l-p[i]),l); if(i > n-k) { dp2[i] = c; } else { dp2[i] = c+dp2[i+k]; } } for(int i = 0; i <= n; i++) { ans = min(ans,dp1[i]+dp2[i]); } 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...