結果

問題 No.1564 Sum of Products of Pairs
ユーザー titan23
提出日時 2022-06-29 02:27:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 246 ms / 2,000 ms
コード長 274 bytes
コンパイル時間 159 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 105,984 KB
最終ジャッジ日時 2024-11-21 21:38:38
合計ジャッジ時間 5,926 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from heapq import heapify, heappush, heappop
input = lambda: sys.stdin.readline().rstrip()

#  -----------------------  #

n = int(input())
hq = list(map(int, input().split()))
heapify(hq)

ans = 0
for _ in range(n):
  ans += heappop(hq) * heappop(hq)
print(ans)
0