제출 #779790

#제출 시각아이디문제언어결과실행 시간메모리
779790zsombor선물상자 (IOI15_boxes)C++17
0 / 100
59 ms156852 KiB
#include <iostream> #include <algorithm> #include <vector> #include "boxes.h" using namespace std; using ll = long long; vector <ll> l(1e7, 0); vector <ll> r(1e7, 0); ll delivery(int N, int K, int L, int p[]) { for (int i = 0; i < N; i++) l[i] = i < K ? 2 * p[i] : l[i - K] + 2 * p[i]; for (int i = N - 1; i >= 0; i--) r[i] = i >= N - K ? 2 * (L - p[i]) : r[i + K] + 2 * (L - p[i]); ll ans = 1e17; ans = min(ans, r[K] + L); ans = min(ans, l[N - K - 1] + L); for (int i = 0; i < N - K - 1; i++) ans = min(ans, l[i] + r[i + K + 1] + 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...