# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
682005 | vjudge1 | Mobile (BOI12_mobile) | C11 | 0 ms | 0 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 <stdio.h>
#include <math.h>
double distance(int x1, int y1, int x2, int y2) {
return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
int main() {
int n, l;
scanf("%d %d", &n, &l);
int x[n], y[n];
for (int i = 0; i < n; i++) {
scanf("%d %d", &x[i], &y[i]);
}
double max_distance = 0;
int left = 0, right = 1;
for (int i = 0; i <= l; i++) {
while (right < n && distance(x[right], y[right], i, 0) < distance(x[left], y[left], i, 0)) {
left++;
right++;
}
max_distance = fmax(max_distance, distance(x[left], y[left], i, 0));
}
printf("%.3lf\n", max_distance);
return 0;
}