제출 #791795

#제출 시각아이디문제언어결과실행 시간메모리
791795jasmin선물상자 (IOI15_boxes)C++17
100 / 100
479 ms293852 KiB
#include "boxes.h" #include<bits/stdc++.h> using namespace std; const long long INF=LLONG_MAX; long long delivery(int n, int k, int l, int p[]) { vector<long long> left(n+1); left[0]=0; for(int i=0; i<n; i++){ long long distance = min(p[i], l-p[i]); left[i+1] = left[max(0, i+1-k)] + distance + p[i]; } vector<long long> right(n+1); right[0]=0; for(int i=0; i<n; i++){ long long distance = min(p[n-1-i], l-p[n-1-i]); right[i+1] = right[max(0, i+1-k)] + distance + l-p[n-1-i]; } long long ans=INF; for(int i=0; i<=n; i++){ ans = min(ans, left[i] + right[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...