#K14766. Closest to Zero Pair
Closest to Zero Pair
Closest to Zero Pair
You are given an array of n integers. Your task is to find the pair of elements whose sum is closest to zero. In other words, you need to select two numbers a and b from the array such that the absolute value of their sum, \(|a+b|\), is minimized.
If there are multiple valid answers, you may output any one of them.
Note: The input is provided via standard input and the answer should be printed to standard output.
inputFormat
The first line of the input contains a single integer n (\(2 \le n \le 10^5\)), representing the number of integers in the array. The second line contains n space-separated integers.
outputFormat
Print two integers separated by a space, representing the pair from the array whose sum is closest to zero. If there are multiple answers, any valid pair is acceptable.
## sample2
-1 2
-1 2