Submission #404866

#TimeUsernameProblemLanguageResultExecution timeMemory
404866TrunktyBoxes with souvenirs (IOI15_boxes)C++14
100 / 100
543 ms195988 KiB
#include "boxes.h" #include <iostream> using namespace std; long long mini; long long nclock[10000005]; long long cclock[10000005]; long long delivery(int n, int k, int l, int p[]) { for(int i=0;i<n;i++){ if(i<k){ nclock[i] = min(p[i]*2,l); } else{ nclock[i] = nclock[i-k]; nclock[i] += min(p[i]*2,l); } } for(int i=n-1;i>=0;i--){ if(i>=n-k){ cclock[i] = min((l-p[i])*2,l); } else{ cclock[i] = cclock[i+k]; cclock[i] += min((l-p[i])*2,l); } } mini = cclock[0]; for(int i=0;i<n;i++){ mini = min(mini,nclock[i]+cclock[i+1]); } return mini; }
#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...