제출 #567899

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