Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import deque
- n = int(input())
- res = 0
- N = deque(sorted(list(map(int, input().split()))))
- while len(N) != 0:
- res += (N[0] + N[-1]) ** 2
- N.popleft()
- N.pop()
- print(res)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement