| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 682005 | vjudge1 | Mobile (BOI12_mobile) | C11 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
