제출 #1091549

#제출 시각아이디문제언어결과실행 시간메모리
1091549triplem5ds선물상자 (IOI15_boxes)C++14
25 / 100
0 ms448 KiB
#include "boxes.h" #include <bits/stdc++.h> long long cost1[10000007]; long long cost2[10000007]; using namespace std; long long delivery(int N, int K, int L, int p[]) { if(N == 1) return min(p[0], L - p[0]); for(int i = 0; i < K; i++) { long long cur1 = 0, cur2 = 0; for(int j = i; j < N; j+=K) { cur1 += min(p[j]*2,L); cur2 += min((L-p[N-1-j])*2,L); cost1[j] = cur1; cost2[j] = cur2; } } long long ans = min(cost1[N - 1], cost2[N - 1]); for(int i = 0; i < N - 1; i++) { ans = min(ans, cost1[i] + cost2[N-1-(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...