Submission #544125

#TimeUsernameProblemLanguageResultExecution timeMemory
544125krit3379Boxes with souvenirs (IOI15_boxes)C++14
100 / 100
553 ms293732 KiB
#include<bits/stdc++.h> using namespace std; #define N 10000005 long long dp1[N],dp2[N],ans=1e18; long long delivery(int n,int k,int l,int pos[N]){ int i; for(i=1;i<=n;i++)dp1[i]=dp1[max(0,i-k)]+pos[i-1]+min(pos[i-1],l-pos[i-1]); for(i=n;i>0;i--)dp2[i]=dp2[min(n+1,i+k)]+l-pos[i-1]+min(pos[i-1],l-pos[i-1]); for(i=0;i<=n;i++)ans=min(ans,dp1[i]+dp2[i+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...