제출 #70590

#제출 시각아이디문제언어결과실행 시간메모리
70590mr_banana선물상자 (IOI15_boxes)C++17
100 / 100
698 ms117788 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; const int MN=1e7+10; long long dp[MN]; long long delivery(int n, int k, int l, int p[]) { sort(p,p+n); for(int i=0;i<n;i++){ dp[i]=min(2*p[i],l); if(i-k>=0){ dp[i]+=dp[i-k]; } } long long ans=dp[n-1]; for(int i=n-1;i>=0;i--){ dp[i]=min(2*(l-p[i]),l); if(i+k<n){ dp[i]+=dp[i+k]; } if(i){ ans=min(ans,dp[i]+dp[i-1]); } else{ ans=min(ans,dp[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...