Submission #31237

#TimeUsernameProblemLanguageResultExecution timeMemory
3123714kgBoxes with souvenirs (IOI15_boxes)C++11
100 / 100
535 ms196112 KiB
#include "boxes.h" #define N 10000001 #define INF 999999999999999999 #define max2(x,y) (x>y?x:y) #define min2(x,y) (x<y?x:y) #define LL long long long long d1[N], d2[N]; long long delivery(int n, int m, int len, int p[]){ long long out=INF; for(int i=1; i<=n; i++) d1[i]=d1[max2(i-m,0)]+(LL)p[i-1]+(LL)min2(p[i-1],len-p[i-1]); for(int i=n; i>=1; i--) d2[i]=d2[min2(i+m,n+1)]+(LL)(len-p[i-1])+(LL)min2(p[i-1],len-p[i-1]); for(int i=0; i<=n; i++) out=min2(out,d1[i]+d2[i+1]); return out; }
#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...