# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
746901 | 2023-05-23T08:23:38 Z | vjudge1 | Calvinball championship (CEOI15_teams) | C++17 | 0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; long long delivery(int N, int K, int L, vector<int> positions) { long long ans = 0; for (int i = N - 1; i >= 0; i -= K) { if (positions[max(0, i - K + 1)] > L / 2) ans += 2 * (L - positions[i - K + 1]); else if (positions[i] > L / 2) ans += L; else ans += 2 * positions[i]; cerr << positions[i] << ", " << ans << endl; } return ans; }