結果

問題 No.972 選び方のスコア
ユーザー stngstng
提出日時 2022-08-18 18:52:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 425 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 98,816 KB
最終ジャッジ日時 2024-04-16 02:43:52
合計ジャッジ時間 5,137 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
96,512 KB
testcase_01 AC 133 ms
98,688 KB
testcase_02 AC 132 ms
98,560 KB
testcase_03 AC 93 ms
81,280 KB
testcase_04 AC 135 ms
98,816 KB
testcase_05 AC 134 ms
98,432 KB
testcase_06 AC 134 ms
98,688 KB
testcase_07 AC 120 ms
96,896 KB
testcase_08 AC 99 ms
97,152 KB
testcase_09 AC 98 ms
96,640 KB
testcase_10 AC 97 ms
96,640 KB
testcase_11 AC 98 ms
97,536 KB
testcase_12 AC 104 ms
97,536 KB
testcase_13 AC 104 ms
97,408 KB
testcase_14 AC 104 ms
97,792 KB
testcase_15 AC 115 ms
98,432 KB
testcase_16 AC 109 ms
96,640 KB
testcase_17 AC 109 ms
97,024 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 41 ms
51,840 KB
testcase_26 AC 41 ms
51,712 KB
testcase_27 AC 42 ms
51,712 KB
testcase_28 AC 41 ms
51,712 KB
testcase_29 AC 42 ms
51,968 KB
testcase_30 AC 42 ms
51,968 KB
testcase_31 AC 42 ms
51,840 KB
testcase_32 AC 42 ms
52,224 KB
testcase_33 AC 41 ms
51,968 KB
testcase_34 AC 41 ms
52,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0