Advertisement
Bad_Programist

Untitled

Jan 31st, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.20 KB | None | 0 0
  1. from collections import deque
  2. n = int(input())
  3. res = 0
  4. N = deque(sorted(list(map(int, input().split()))))
  5. while len(N) != 0:
  6.     res += (N[0] + N[-1]) ** 2
  7.     N.popleft()
  8.     N.pop()
  9. print(res)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement