結果
| 問題 |
No.972 選び方のスコア
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-08-18 18:52:00 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 425 bytes |
| コンパイル時間 | 761 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 99,032 KB |
| 最終ジャッジ日時 | 2024-10-06 13:02:17 |
| 合計ジャッジ時間 | 5,124 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 WA * 7 |
ソースコード
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
rui = [0]*(n+1)
for i in range(n):
rui[i+1] = rui[i]+a[i]
#print(rui)
tmp = 0
now = a[0]
ans = 0
for i in range((n-1)//2):
tmp = 0
#bfr = a[i]
aft = a[i+1]
#chu = aft
tmp += (rui[i+1]-rui[0])-aft*(i+1)
#print(tmp,"t1")
tmp += (rui[n]-rui[n-i-1])-aft*(i+1)
#print(tmp,"t2")
ans = max(ans,tmp)
#print(tmp)
print(ans)