Submission #444858

#TimeUsernameProblemLanguageResultExecution timeMemory
444858osmanallazovBoxes with souvenirs (IOI15_boxes)C++14
20 / 100
1 ms204 KiB
#include "boxes.h" #include<bits/stdc++.h> using namespace std; long long delivery(int N, int K, int L, int p[]) { long long pref[N]; long long suff[N]; for(int i=0;i<N;i++){ if(i<K){ pref[i]=min(L,p[i]*2); } else{ pref[i]=min(L,p[i]*2)+pref[i/K*K-1]; } } for(int i=N-1;i>=0;i--){ if(N-i-1<K){ suff[i]=min(2*(L-p[i]),L); } else{ suff[i]=min(2*(L-p[i]),L)+suff[i/K*K+1]; } } long long res=min(pref[N-1],suff[0]); for(int i=0;i<N-1;i++){ res=min(res,pref[i]+suff[i+1]); } return res; }
#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...