結果

問題 No.972 選び方のスコア
ユーザー maspymaspy
提出日時 2020-03-18 13:02:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 470 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 10,708 KB
実行使用メモリ 27,444 KB
最終ジャッジ日時 2023-08-20 19:50:03
合計ジャッジ時間 8,665 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 228 ms
27,148 KB
testcase_01 AC 227 ms
27,100 KB
testcase_02 AC 221 ms
26,172 KB
testcase_03 AC 120 ms
17,864 KB
testcase_04 AC 234 ms
27,220 KB
testcase_05 AC 229 ms
27,124 KB
testcase_06 AC 232 ms
27,120 KB
testcase_07 AC 167 ms
22,392 KB
testcase_08 AC 164 ms
27,240 KB
testcase_09 AC 157 ms
26,592 KB
testcase_10 AC 156 ms
27,240 KB
testcase_11 AC 156 ms
27,084 KB
testcase_12 AC 164 ms
27,256 KB
testcase_13 AC 161 ms
27,136 KB
testcase_14 AC 166 ms
27,200 KB
testcase_15 AC 168 ms
26,700 KB
testcase_16 AC 172 ms
27,272 KB
testcase_17 AC 171 ms
27,196 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 19 ms
8,512 KB
testcase_26 AC 19 ms
8,488 KB
testcase_27 AC 18 ms
8,468 KB
testcase_28 AC 18 ms
8,408 KB
testcase_29 AC 19 ms
8,392 KB
testcase_30 AC 18 ms
8,396 KB
testcase_31 AC 18 ms
8,552 KB
testcase_32 AC 18 ms
8,552 KB
testcase_33 AC 19 ms
8,476 KB
testcase_34 AC 19 ms
8,536 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque

N, *A = map(int, read().split())
A = deque(sorted(A))

S = A.popleft()
med = S
best_score = 0
elem = 1
while len(A) > 1:
    L = A.popleft()
    R = A.pop()
    med = L
    S += L + R
    elem += 2
    score = S - med * elem
    if best_score < score:
        best_score = score

print(best_score)
0