22. Close Proximity (2)

Time Limit: 1 seconds

Memory Limit: 128 MB

Rating: 1000

Problem Statement

The developers want to expand the project to fans. Create a library of superheroes and their fixed location. Ask the user for their location and output the position of the closest superhero to them.

Input

The first line has integer $N$ $(1 \le N \le 1,000)$, denoting the number of superheroes to track. The next $N$ lines contain coordinates $X_i$ and $Y_i$, the position of a superhero. The last line contains the fan's location to search from, $x$ and $y$.

Output

Output two space-separated integers: $X$ and $Y$, the position of the closest superhero to the fan. Use Euclidean distance to calculate your answer.

Sample Cases
Sample Input 1:
4
0 0
-1 1
-5 -8
-7 -1
0 0

Sample Output 1:
0 0


Sample Input 2:
3
1 1
-4 3
9 3
9 1

Sample Output 2:
9 3
Explanation

Not available for this problem.

Sources

KL Coding Cup 2022 > Problem 7 > Intermediate League

Submit | Back