# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
763784 | MilosMilutinovic | Measures (CEOI22_measures) | C++14 | 1587 ms | 1240 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;
const int N = 3e5 + 10;
int n, m, d, a[N], b[N];
bool check(double x) {
double prv = -2e9;
for (int i = 1; i <= n; i++) {
double L = a[i] - x;
double R = a[i] + x;
double pos = max(L, prv + d);
if (pos > R) {
return false;
}
prv = pos;
}
return true;
}
int main() {
scanf("%d%d%d", &n, &m, &d);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
}
for (int i = 1; i <= m; i++) {
scanf("%d", &b[i]);
}
for (int i = 1; i <= m; i++) {
a[++n] = b[i];
sort(a + 1, a + n + 1);
int low = 0, high = 2e9, ans = 2e9;
while (low <= high) {
int mid = (low + high) / 2;
if (check(mid)) {
ans = mid;
high = mid - 1;
} else {
low = mid + 1;
}
}
if (ans > 0 && check(ans - 0.5))
printf("%d.5 ", ans - 1);
else
printf("%d ", ans);
}
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... |