35 lines
781 B
Python
35 lines
781 B
Python
import sys
|
|
input = sys.stdin.readline
|
|
|
|
N = int(input())
|
|
value = sorted(list(map(int, input().split())))
|
|
|
|
def twoPointer(fixIndex) :
|
|
absSum = 30**9
|
|
fixNum = value[fixIndex]
|
|
L, vL, R, vR = fixIndex+1, value[fixIndex+1], len(value)-1, value[len(value)-1]
|
|
|
|
while L != R :
|
|
temp = value[L] + value[R] + fixNum
|
|
|
|
if absSum > abs(temp) :
|
|
absSum = abs(temp)
|
|
vL = value[L]
|
|
vR = value[R]
|
|
|
|
if temp > 0 :
|
|
R -= 1
|
|
else :
|
|
L += 1
|
|
|
|
return absSum, (fixNum, vL, vR)
|
|
|
|
resultValue = 30**9
|
|
resultPair = (0,0,0)
|
|
for i in range(len(value)-2) :
|
|
a, b = twoPointer(i)
|
|
if resultValue > a :
|
|
resultPair = b
|
|
resultValue = a
|
|
|
|
print(" ".join(map(str, resultPair))) |