제출 #986368

#제출 시각아이디문제언어결과실행 시간메모리
986368Pyqe선물상자 (IOI15_boxes)C++17
100 / 100
526 ms372076 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; long long n,a[10000069],dp[2][10000069],inf=1e18; long long delivery(int on,int d,int ln,int aa[]) { long long i,ii,u,z=inf; n=on; for(i=1;i<=n;i++) { a[i]=aa[i-1]; } for(ii=0;ii<2;ii++) { u=!ii*2-1; for(i=1+(n-1)*ii;i!=(n+1)*!ii;i+=u) { dp[ii][i]=dp[ii][min(max(i-d*u,0ll),n+1)]+abs(a[i]-ln*ii)*2; } } for(i=0;i<=n;i++) { z=min(z,dp[0][i]+min(dp[1][i+1],dp[1][min(i+d+1,n+1)]+ln)); } return z; }
#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...