Submission #521050

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