제출 #1008403

#제출 시각아이디문제언어결과실행 시간메모리
1008403andro선물상자 (IOI15_boxes)C++14
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; long long delivery(int N, int K, int L, int p[]) { long long ans = 1e18; vector<long long> pref(N, 0); vector<long long> suf(N, 0); for(int i = 0; i < N; i++) { if(i >= K) { pref[i] = pref[i - K]; } pref[i] += p[i] * 2; } for(int i = N - 1; i >= 0; i--) { if(i + K < N) { suf[i] = suf[i + K]; } suf[i] += (L - p[i]) * 2; } for(int i = 0; i < N - 1; i++) { ans = min(ans, pref[i] + suf[i + 1]); } return ans; } /* int main() { int X[3] = {1, 2, 5}; cout << delivery(3, 2, 8, X); }*/
#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...