Submission #541483

#TimeUsernameProblemLanguageResultExecution timeMemory
541483JomnoiBoxes with souvenirs (IOI15_boxes)C++17
20 / 100
1 ms212 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; long long delivery(int N, int K, int L, int p[]) { long long ans = 0; if(K == 1) { for(int i = 0; i < N; i++) { ans += 2 * min(p[i], L - p[i]); } } else if(K == N) { ans = L; ans = min(ans, 2ll * p[N - 1]); ans = min(ans, 2ll * (L - p[0])); for(int i = 1; i < N; i++) { ans = min(ans, 2ll * p[i - 1] + 2ll * (L - p[i])); } } 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...