#C447. Minimal Maximum Euclidean Distance
Minimal Maximum Euclidean Distance
Minimal Maximum Euclidean Distance
You are given n delivery agents and m customers, where typically n = m. Each delivery agent is located at a coordinate \( (x,y) \) and each customer is located at a coordinate \( (x,y) \). Your task is to assign each agent to a distinct customer so that the maximum Euclidean distance any delivery agent has to travel is minimized.
The Euclidean distance between two points \( (x_1, y_1) \) and \( (x_2, y_2) \) is defined as:
\[ \sqrt{(x_1-x_2)^2+(y_1-y_2)^2} \]Output the minimal possible maximum distance rounded to the nearest integer.
inputFormat
The input is given via stdin and has the following format:
- The first line contains two integers
n
andm
(the number of agents and customers, respectively). - The next
n
lines each contain two integers representing the coordinates of each delivery agent. - The following
m
lines each contain two integers representing the coordinates of each customer.
It is guaranteed that n = m
.
outputFormat
Print a single integer to stdout — the minimal possible maximum Euclidean distance that any delivery agent must travel, rounded to the nearest integer.
## sample3 3
0 0
1 1
2 2
2 0
1 2
0 2
2