제출 #47617

#제출 시각아이디문제언어결과실행 시간메모리
47617RezwanArefin01선물상자 (IOI15_boxes)C++11
100 / 100
510 ms196176 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; ll delivery(int n, int k, int L, int p[]) { ll l[n + 1], r[n + 1]; l[0] = r[0] = 0; for(int i = 1; i <= n; i++) { l[i] = 2ll * p[i - 1] + (i - k >= 0 ? l[i - k] : 0); r[i] = 2ll * (L - p[n - i]) + (i - k >= 0 ? r[i - k] : 0); } ll mn = 1e18; for(int i = 0; i <= n; i++) { mn = min(mn, l[i] + r[n - i]); if(n - k - i >= 0) mn = min(mn, l[i] + r[n - k - i] + L); } return mn; }
#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...