제출 #996463

#제출 시각아이디문제언어결과실행 시간메모리
996463fryingduc선물상자 (IOI15_boxes)C++17
0 / 100
1 ms2396 KiB
#include "bits/stdc++.h" #include "boxes.h" using namespace std; const int maxn = 1e7 + 7; long long fcw[maxn], fccw[maxn]; long long delivery(int n, int k, int l, int pos[]) { for(int i = 0; i < n; ++i) { fcw[i] = pos[i] + min(pos[i], l - pos[i]); if(i - k >= 0) fcw[i] += fcw[i - k]; } for(int i = n - 1; i >= 0; --i) { fccw[i] = fccw[min(n, i + k)] + (l - pos[i]) + min(pos[i], l - pos[i]); } long long ans = min(fcw[0], fccw[n - 1]); for(int i = 0; i < n; ++i) { ans = min(ans, fcw[i] + fccw[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...