結果
| 問題 |
No.972 選び方のスコア
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-08-18 18:45:00 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 420 bytes |
| コンパイル時間 | 383 ms |
| コンパイル使用メモリ | 82,164 KB |
| 実行使用メモリ | 98,964 KB |
| 最終ジャッジ日時 | 2024-10-06 12:50:31 |
| 合計ジャッジ時間 | 5,640 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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):
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)