https://www.acmicpc.net/problem/2467

어쨌거나 두 수의 합을 구하는 문제. 더했을 때 0이랑 제일 근접한 두 수 출력.
쉽게 하는 방법: 0 일 때 exit() 해서 코드 종료 시키기
n = int(input())
mlist = list(map(int, input().split()))
start = 0
end = n-1
left = 0
right = n-1
closetozero = float('inf')
while start < end:
temp = mlist[start] + mlist[end]
if abs(temp) < abs(closetozero):
closetozero = temp
left = start
right = end
if temp == 0:
print(mlist[start], mlist[end])
exit()
elif temp > 0:
end = end - 1
else:
start = start + 1
print(mlist[left], mlist[right])
만약 abs(temp) 보다 abs(closetozero)가 크면, closetozero를 temp로 바꿔주고, left와 right 도 start 와 끝으로 업데이트 해준다.