https://www.acmicpc.net/problem/2470
import sys
input = sys.stdin.readline
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
start = 0
end = len(arr)-1
ans = abs(arr[start]+arr[end])
final = [arr[start], arr[end]]
while start < end:
temp = arr[end] + arr[start]
if abs(temp) < ans:
ans = abs(temp)
final = [arr[start], arr[end]]
if ans == 0:
break
if temp < 0:
start += 1
else:
end -= 1
print(final[0], final[1])
투포인터와 이분탐색을 이용하면 된다.