Submission #752000

#TimeUsernameProblemLanguageResultExecution timeMemory
752000LCJLYBoxes with souvenirs (IOI15_boxes)C++14
10 / 100
1 ms308 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; long long delivery(int n, int k, int l, int arr[]) { int prefix[n+5]; int suffix[n+5]; memset(prefix,0,sizeof(prefix)); memset(suffix,0,sizeof(suffix)); for(int x=1;x<=n;x++){ prefix[x]=prefix[max(0,x-k)]+2*arr[x-1]; } for(int x=n;x>=1;x--){ suffix[x]=suffix[min(n+1,x+k)]+2*(l-arr[x-1]); } int best=INT_MAX; for(int x=0;x<=n;x++){ best=min(best,prefix[x]+suffix[x+1]); } for(int x=0;x<=n-k;x++){ best=min(best,prefix[x]+suffix[x+k+1]+l); } return best; }
#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...