제출 #120337

#제출 시각아이디문제언어결과실행 시간메모리
120337turbat선물상자 (IOI15_boxes)C++14
0 / 100
2 ms384 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; long long a[10000005], dp[10000005], dp1[10000005], ans = 1e18; long long delivery(int N, int K, int L, int p[]) { for (int i = 0;i < N;i++){ a[i] = L - p[N - 1 - i]; if (i < K) { dp[i + 1] = p[i] * 2; dp1[i + 1] = a[i] * 2; } else { dp[i + 1] = dp[i - K + 1] + p[i] * 2; dp1[i + 1] = dp1[i - K + 1] + a[i] * 2; } } for (int i = 0;i <= N;i++){ ans = min(ans, dp[i] + dp[N - i]); if (i + K <= N) ans = min(ans, dp[i] + L + dp1[N - i - K]); } 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...