제출 #322424

#제출 시각아이디문제언어결과실행 시간메모리
322424tigicha선물상자 (IOI15_boxes)C++17
100 / 100
570 ms294128 KiB
#include "boxes.h" #include<bits/stdc++.h> using namespace std; long long ans, dp1[10000001], dp2[10000001]; long long delivery(int n, int k, int l, int a[]){ for(long long i=0; i<n; i++){ dp1[i+1]=2*a[i]; if(i>=k) dp1[i+1]+=dp1[i-k+1]; } for(long long i=n-1; i>=0; i--){ dp2[i+1]=2*(l-a[i]); if(i<n-k) dp2[i+1]+=dp2[i+k+1]; } ans=min(dp1[n], dp2[1]); for(long long i=1; i<=n-k+1; i++) ans=min(ans, dp1[i-1]+l+dp2[i+k]); for(long long i=1; i<n; i++) ans=min(ans, dp1[i]+dp2[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...