# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
968519 | duckindog | Boxes with souvenirs (IOI15_boxes) | C++17 | 1 ms | 460 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#ifndef LOCAL
#include "boxes.h"
#endif
long long delivery(int n, int k, int l, int p[]) {
if (k == 1 || k == n) {
long long answer = 0;
for (int i = 0; i < n; ++i) answer += min(p[i], l - p[i]);
if (k == 1) return answer << 1;
return min(1ll * l, answer << 1);
}
}
#ifdef LOCAL
const int N = 10'000'000 + 10;
int n, k, l;
int p[N];
int32_t main() {
cin.tie(0)->sync_with_stdio(0);
cin >> n >> k >> l;
for (int i = 0; i < n; ++i) cin >> p[i];
cout << delivery(n, k, l, p) << "\n";
}
#endif
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |