結果

問題 No.972 選び方のスコア
ユーザー rlangevinrlangevin
提出日時 2023-07-13 08:59:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 190 bytes
コンパイル時間 273 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 109,236 KB
最終ジャッジ日時 2023-10-12 22:23:25
合計ジャッジ時間 7,909 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 159 ms
101,352 KB
testcase_01 AC 157 ms
101,480 KB
testcase_02 AC 154 ms
100,924 KB
testcase_03 AC 111 ms
91,568 KB
testcase_04 AC 156 ms
101,436 KB
testcase_05 AC 157 ms
101,364 KB
testcase_06 AC 156 ms
101,372 KB
testcase_07 AC 134 ms
103,216 KB
testcase_08 AC 125 ms
99,760 KB
testcase_09 AC 123 ms
101,984 KB
testcase_10 AC 121 ms
100,196 KB
testcase_11 AC 122 ms
100,596 KB
testcase_12 AC 128 ms
100,480 KB
testcase_13 AC 127 ms
100,596 KB
testcase_14 AC 126 ms
100,560 KB
testcase_15 AC 136 ms
101,256 KB
testcase_16 AC 133 ms
101,816 KB
testcase_17 AC 133 ms
101,276 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 71 ms
71,176 KB
testcase_26 AC 71 ms
71,280 KB
testcase_27 AC 72 ms
71,100 KB
testcase_28 AC 71 ms
71,420 KB
testcase_29 AC 70 ms
71,004 KB
testcase_30 AC 71 ms
71,400 KB
testcase_31 AC 75 ms
71,300 KB
testcase_32 AC 69 ms
71,312 KB
testcase_33 AC 71 ms
71,328 KB
testcase_34 AC 70 ms
71,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

print(ans)
0