Submission #67805

#TimeUsernameProblemLanguageResultExecution timeMemory
67805MANcityBoxes with souvenirs (IOI15_boxes)C++14
35 / 100
2 ms400 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=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) { d1[i]=0; d2[i]=0; } for1(i,n) d1[i]=d1[max(0,i-k)]+min(l,2*P[i]); ans=min(ans,d1[n]); forn(i,n) d2[i]=d2[min(n+1,i+k)]+min(l,2*(l-P[i])); ans=min(ans,d2[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...