結果

問題 No.1564 Sum of Products of Pairs
ユーザー FromBooskaFromBooska
提出日時 2023-06-18 19:34:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 150 ms / 2,000 ms
コード長 320 bytes
コンパイル時間 825 ms
コンパイル使用メモリ 87,012 KB
実行使用メモリ 108,400 KB
最終ジャッジ日時 2023-09-08 15:39:39
合計ジャッジ時間 7,069 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
70,796 KB
testcase_01 AC 73 ms
71,012 KB
testcase_02 AC 72 ms
71,196 KB
testcase_03 AC 111 ms
90,472 KB
testcase_04 AC 79 ms
75,964 KB
testcase_05 AC 122 ms
94,768 KB
testcase_06 AC 105 ms
88,360 KB
testcase_07 AC 93 ms
82,676 KB
testcase_08 AC 84 ms
77,992 KB
testcase_09 AC 100 ms
84,044 KB
testcase_10 AC 121 ms
94,908 KB
testcase_11 AC 127 ms
97,992 KB
testcase_12 AC 108 ms
90,252 KB
testcase_13 AC 72 ms
71,196 KB
testcase_14 AC 73 ms
71,188 KB
testcase_15 AC 71 ms
71,172 KB
testcase_16 AC 74 ms
71,160 KB
testcase_17 AC 72 ms
71,204 KB
testcase_18 AC 144 ms
107,892 KB
testcase_19 AC 141 ms
104,356 KB
testcase_20 AC 144 ms
107,828 KB
testcase_21 AC 144 ms
107,936 KB
testcase_22 AC 138 ms
104,164 KB
testcase_23 AC 149 ms
108,400 KB
testcase_24 AC 145 ms
107,816 KB
testcase_25 AC 145 ms
107,820 KB
testcase_26 AC 145 ms
107,864 KB
testcase_27 AC 150 ms
108,072 KB
testcase_28 AC 72 ms
71,164 KB
testcase_29 AC 74 ms
70,932 KB
testcase_30 AC 72 ms
71,144 KB
testcase_31 AC 74 ms
71,280 KB
testcase_32 AC 74 ms
71,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# すべて正整数なのでソートして掛け算すればいいだろう
# 負が入ると面倒かも
# 逆に最小にするには最大と最小をかけていくはず

N = int(input())
A = list(map(int, input().split()))
A.sort()
ans = 0
for i in range(N):
    calc = A[i*2]*A[i*2+1]
    ans += calc
print(ans)
0