Submission #45698

#TimeUsernameProblemLanguageResultExecution timeMemory
45698RayaBurong25_1Boxes with souvenirs (IOI15_boxes)C++17
100 / 100
536 ms196048 KiB
#include "boxes.h" #define INF 1000000000000000000LL long long min(long long a, long long b) { return (a < b)?a:b; } long long l[10000005]; long long r[10000005]; long long delivery(int N, int K, int L, int p[]) { int i; long long ans = INF; for (i = 0; i < N; i++) l[i] = 2LL*p[i] + ((i >= K)?l[i - K]:0); for (i = N - 1; i >= 0; i--) r[i] = 2LL*(L - p[i]) + ((i + K < N)?r[i + K]:0); //no circle for (i = 0; i <= N; i++) ans = min(ans, (i > 0)*l[i - 1] + (i < N)*r[i]); //one circle for (i = 0; i + K <= N; i++) ans = min(ans, (i > 0)*l[i - 1] + L + (i + K < N)*r[i + K]); 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...