Submission #1232508

#TimeUsernameProblemLanguageResultExecution timeMemory
123250812baaterBoxes with souvenirs (IOI15_boxes)C++20
0 / 100
0 ms328 KiB
#include "boxes.h" #include <algorithm> long long delivery(int N, int K, int L, int p[]) { int maxUnder = 0, minOver = 2000000000; for (int i = 0; i < N; i++) { if (p[i] > L/2) { minOver = std::min(minOver, p[i]); } else { maxUnder = std::max(maxUnder, p[i]); } } long long total = 0; if (p[N-1] <= L/2) { total = p[N-1] * 2; } else if (p[0] > L/2) { total = (L - p[0]) * 2; } else { total = L; } return std::min(total, static_cast<long long>(2*maxUnder + 2*(L-minOver))); }
#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...