Submission #225704

#TimeUsernameProblemLanguageResultExecution timeMemory
225704staniewzkiBoxes with souvenirs (IOI15_boxes)C++17
100 / 100
877 ms56952 KiB
#include<bits/stdc++.h> using namespace std; long long delivery(int N, int K, int L, int p[]) { sort(p, p + N); vector<long long> l(K), r(K); for(int i = 0; i < N; i++) l[(i + 1) % K] += min(2 * p[i], L); long long ans = l[N % K]; for(int i = N - 1; i >= 0; i--) { l[(i + 1) % K] -= min(2 * p[i], L); r[i % K] += min(2 * (L - p[i]), L); ans = min(ans, l[i % K] + 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...