Submission #70551

#TimeUsernameProblemLanguageResultExecution timeMemory
70551Sa1378Boxes with souvenirs (IOI15_boxes)C++17
10 / 100
2 ms376 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define N ((int)1e7+10) ll dp[N]; ll delivery(int n,int k, int l, int p[]) { int id=0; for(int i=0;i<n && p[i]<=l/2;i++,id++) dp[i]=2*p[i]+((i+k<0)?0:dp[i-k]); for(int i=n-1;i>=0 && p[i]>l/2;i--) dp[i]=2*(l-p[i])+((i+k>=n)?0:dp[i+k]); ll ans=min((ll)(n+k-1)/k*l,((id>0)?dp[id-1]:0)+dp[id]); int lft=max(0,id-k),rght=l+k; while(lft<=id && rght<=n) ans=min(ans,dp[rght]+((lft>0)?dp[lft-1]:0)+l), lft++,rght++; 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...