제출 #67812

#제출 시각아이디문제언어결과실행 시간메모리
67812MANcity선물상자 (IOI15_boxes)C++14
100 / 100
542 ms235332 KiB
#include<iostream> #include<cstdio> #include<fstream> #include<algorithm> #include<cmath> #include<map> #include<queue> #include<set> #include<stack> #include<string> #include<cstring> #include<vector> #include "boxes.h" using namespace std; #define for1(i,n) for(int i=1;i<=(int)n;i++) #define for0(i,n) for(int i=0;i<=(int)n;i++) #define forn(i,n) for(int i=n;i>=1;i--) #define fo(i,x,y) for(int i=x;i<=(int)y;i++) #define fr(i,x,y) for(int i=x;i>=(int)y;i--) #define pb push_back #define mp make_pair #define LL long long const LL Mod=1000*1000*1000+7; const int N=2*10000002; LL d1[N]; LL d2[N]; int P[N]; LL ans=(LL)((LL)1000*1000*1000*1000*1000); long long delivery(int n, int k, int l, int p[]) { for0(i,n-1) P[i+1]=p[i]; for1(i,n) { d1[i]=d1[max(0,i-k)]+2*P[i]; } forn(i,n) { d2[i]=d2[min(n+1,i+k)]+2*(l-P[i]); } for0(i,n) ans=min(ans,d1[i]+d2[i+1]); for0(i,n) ans=min(ans,d1[i]+l+d2[min(n+1,i+k+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...