Submission #666312

#TimeUsernameProblemLanguageResultExecution timeMemory
666312jamezzzBoxes with souvenirs (IOI15_boxes)C++17
100 / 100
943 ms151896 KiB
#include <bits/stdc++.h> using namespace std; #define LINF 1023456789123456789 typedef long long ll; #define maxn 10000005 ll pfx[maxn], sfx[maxn]; ll delivery(int N, int K, int L, int p[]){ sort(p, p + N); for (int i = 0; i < N; ++i) { sfx[i % K] += min(L, 2 * (L - p[i])); } ll ans = sfx[0]; for (int i = 0; i < N; ++i) { pfx[i % K] += min(L, 2 * p[i]); sfx[i % K] -= min(L, 2 * (L - p[i])); ans = min(ans, pfx[i % K] + sfx[(i + 1) % 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...