제출 #297698

#제출 시각아이디문제언어결과실행 시간메모리
297698maximath_1선물상자 (IOI15_boxes)C++11
100 / 100
537 ms213752 KiB
#include "boxes.h" #include <algorithm> using namespace std; long long tmp = 0ll, pref[10000005], suff[10000005]; long long delivery(int N, int K, int L, int p[]) { for(int i = 1; i <= N; i ++){ pref[i] = min(p[i - 1] << 1, L); if(i > K) pref[i] += pref[i - K]; } for(int i = N - 1; i >= 0; i --){ suff[i] = min((L - p[i]) << 1, L); if(N - i > K) suff[i] += suff[i + K]; } long long ans = pref[N]; for(int i = 0; i < N; i ++) ans = min(ans, pref[i] + suff[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...