제출 #43088

#제출 시각아이디문제언어결과실행 시간메모리
43088leejseo선물상자 (IOI15_boxes)C++14
100 / 100
538 ms235336 KiB
#include <bits/stdc++.h> using namespace std; int N, K, L; long long CW[10000005]; long long CCW[10000005]; int P[10000005]; long long delivery (int n, int k, int l, int p[]){ N = n, K = k, L = l; for (int i=1; i<=N; i++) P[i] = p[i-1]; for (int i=1; i<=N; i++){ int j = max(i-K, 0); CW[i] = CW[j] + P[i] + min(L-P[i], P[i]); } for (int i=N; i>0; i--){ int j = min(N+1, i+K); CCW[i] = CCW[j] + L - P[i] + min(L - P[i], P[i]); } long long ans = 9e18; for (int i=0; i<=N; i++){ ans = min(ans, CW[i] + CCW[i+1]); } 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...