import sys
n = int(input())
arr = list(map(int, input().split(' ')))
start = 0
end = n - 1
arr.sort()
res = sys.maxsize
final = []
while start < end:
total = arr[start] + arr[end]
if abs(total) < res:
res = abs(total)
final = [arr[start], arr[end]]
if total < 0:
start += 1
else:
end -= 1
print(final[0], final[1])
'테크 > 알고리즘' 카테고리의 다른 글
| <백준> 1644번 파이썬 알고리즘 (0) | 2022.04.20 |
|---|---|
| <백준> 1806번 파이썬 알고리즘 [투 포인터][부분 합] (0) | 2022.04.18 |
| <백준> 3273번 자바 알고리즘 [투 포인터] (0) | 2022.04.13 |
| <백준> 2805번 자바 알고리즘 [이분 탐색] (0) | 2022.03.06 |
| <백준> 1920번 자바 알고리즘 [이분 탐색] (0) | 2022.02.08 |