Submission #1129254

#TimeUsernameProblemLanguageResultExecution timeMemory
1129254coolavy999Boxes with souvenirs (IOI15_boxes)C++20
10 / 100
1 ms396 KiB
// Problem: https://oj.uz/problem/view/IOI15_boxes #include "bits/stdc++.h" using namespace std; using ll = long long; ll delivery(int n, int k, int l, int pos[]) { sort(pos, pos + n); if (k == 1) { // subtask 1 ll ans = 0; int mid = l >> 1; for (int i = 0; i < n; i++) { if (pos[i] <= mid) { ans += 1ll * 2 * pos[i]; } else { ans += 1ll * 2 * (l - pos[i]); } } return ans; } else if (k == n) { // subtask 2 ll ans = 0; int mid = l >> 1; if (pos[0] >= mid) { ans += 1ll * 2 * (l - pos[0]); } else if (pos[n - 1] <= mid) { ans += 1ll * 2 * pos[n - 1]; } else { ans = l; } return ans; } else { // subtask 3-7 return 47; } }
#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...