P4995 跳跳! - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)
n = int(input()) data = list(map(int,input().split())) data.append(0) data.sort()sum = 0 l = 0 r = len(data)-1 flag = 1 while l<=r:sum += (data[l]-data[r])**2if flag:l += 1flag = 0else:r -= 1flag = 1 print(sum)