# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
723370 | t_holl | Measures (CEOI22_measures) | C++14 | 1589 ms | 3620 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;
#define num long long
int N, M; num D;
num compute (vector<num> &res) {
num ans = 0;
vector<num> opt(res.size(), -1);
for (int i = 0; i < res.size(); i ++)
opt[i] = D * i - res[i];
num min_opt = 1e18;
for (int fin = 0; fin < res.size(); fin ++) {
min_opt = min(min_opt, opt[fin]);
ans = max(ans, opt[fin] - min_opt);
}
return ans;
}
int main() {
cin >> N >> M >> D;
vector<num> res;
for (int i = 0; i < N; i ++) {
num x; cin >> x;
res.push_back(x);
}
for (int i = 0; i < M; i ++) {
num x; cin >> x;
res.push_back(x);
sort(res.begin(), res.end());
num total = compute(res);
cout << total / 2;
if (total % 2 == 1) cout << ".5";
cout << " ";
}
cout << endl;
return 0;
}
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... |