#K9806. Drone Round Trip
Drone Round Trip
Drone Round Trip
You are given n drones, each with a specific battery capacity. The drone must complete a round trip between two delivery points A and B in a two-dimensional plane.
The round trip distance is computed as follows. First, the Euclidean distance between the two points is given by:
\(d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}\).
The required battery capacity to complete the round trip is:
\(2d = 2\sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}\).
Your task is to determine if at least one drone has enough battery capacity to cover the required round trip distance. Output YES
if at least one drone can complete the round trip and NO
otherwise.
inputFormat
The input is read from standard input (stdin
) and has the following format:
- An integer n representing the number of drones.
- A line with n space-separated integers, representing the battery capacities of each drone.
- A line with four space-separated integers: x1, y1, x2, and y2, which are the coordinates of the two delivery points.
outputFormat
Output a single line to standard output (stdout
) containing either YES
if there is at least one drone capable of completing the round trip, or NO
if none can complete it.
3
10 20 30
0 0 3 4
YES