Submission #69437

#TimeUsernameProblemLanguageResultExecution timeMemory
69437VahanBoxes with souvenirs (IOI15_boxes)C++17
100 / 100
518 ms196056 KiB
#include "boxes.h" #include<algorithm> using namespace std; long long count_clock[10000006],clock[10000006],pat; long long delivery(int N, int K, int L, int p[]) { for(int i=0;i<N;i++) { if(i<K) clock[i]=2*p[i]; else clock[i]=clock[i-K]+2*p[i]; } pat=clock[N-1]; for(int i=N-1;i>=0;i--) { if(i+K>N-1) count_clock[i]=2*(L-p[i]); else count_clock[i]=count_clock[i+K]+2*(L-p[i]); } pat=min(pat,count_clock[0]); pat=min(count_clock[K]+L,pat); for(int i=0;i<N-K;i++) pat=min(clock[i]+count_clock[i+K+1]+L,pat); for(int i=0;i<N;i++) pat=min(clock[i]+count_clock[i+1],pat); return pat; }
#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...