#K71977. Closest Point to the Origin
Closest Point to the Origin
Closest Point to the Origin
Given a list of points in a 2D plane, your task is to find the point which is closest to the origin \((0, 0)\) using the Euclidean distance. The distance between a point \((x, y)\) and the origin is calculated as \(\sqrt{x^2 + y^2}\). In this problem, you are provided with \(n\) points, and you need to determine the point with the smallest distance. If there are multiple points with the same distance, return the one that appears first in the input.
inputFormat
The input is given via standard input (stdin). The first line contains an integer (n) ((1 \le n \le 10^5)), which denotes the number of points. Each of the following (n) lines contains two space-separated integers (x) and (y), representing the coordinates of a point.
outputFormat
Output a single line to standard output (stdout) containing two space-separated integers representing the coordinates of the point closest to the origin.## sample
1
1 2
1 2