結果

問題 No.972 選び方のスコア
ユーザー ntudantuda
提出日時 2021-11-09 22:43:22
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 258 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 87,072 KB
実行使用メモリ 108,996 KB
最終ジャッジ日時 2023-08-12 07:01:50
合計ジャッジ時間 9,046 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 112 ms
91,708 KB
testcase_04 AC 157 ms
101,500 KB
testcase_05 AC 157 ms
101,404 KB
testcase_06 AC 159 ms
101,464 KB
testcase_07 WA -
testcase_08 AC 122 ms
100,196 KB
testcase_09 AC 121 ms
101,904 KB
testcase_10 AC 123 ms
100,136 KB
testcase_11 AC 123 ms
100,560 KB
testcase_12 AC 124 ms
100,648 KB
testcase_13 AC 125 ms
100,508 KB
testcase_14 AC 125 ms
100,780 KB
testcase_15 AC 136 ms
101,376 KB
testcase_16 AC 134 ms
101,268 KB
testcase_17 AC 133 ms
101,068 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,544 KB
testcase_26 AC 70 ms
71,400 KB
testcase_27 AC 71 ms
71,356 KB
testcase_28 AC 71 ms
71,444 KB
testcase_29 AC 71 ms
71,384 KB
testcase_30 AC 71 ms
71,264 KB
testcase_31 AC 71 ms
71,340 KB
testcase_32 AC 70 ms
71,396 KB
testcase_33 AC 68 ms
71,224 KB
testcase_34 AC 69 ms
71,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = 0
tmp = A[0]
n = 1
flag = 0
for i in range(1,N//2+1):
    tmp += A[i] + A[N - i]
    n += 2
    tmp2 = tmp - n * A[i]
    if tmp2 >= ans:
        ans = tmp2
    else:
        break
print(ans)
0