제출 #1217017

#제출 시각아이디문제언어결과실행 시간메모리
1217017takoshanava선물상자 (IOI15_boxes)C++20
10 / 100
0 ms328 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; long long delivery(int N, int K, int L, int pos[]) { vector<int> a(pos, pos + N); vector<long long> dp1(N + 1, 0); for (int i = 1; i <= N; i++) { if (i <= K) dp1[i] = 2LL * a[i - 1]; else dp1[i] = dp1[i - K] + 2LL * a[i - 1]; } vector<long long> dp2(N + 1, 0); for (int i = 1; i <= N; i++) { long long dist = L - a[N - i]; if (i <= K) dp2[i] = 2LL * dist; else dp2[i] = dp2[i - K] + 2LL * dist; } long long ans = LLONG_MAX; for (int i = 0; i <= N; i++) { ans = min(ans, dp1[i] + dp2[N - 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...