結果

問題 No.972 選び方のスコア
ユーザー ntudantuda
提出日時 2021-11-09 22:43:22
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 258 bytes
コンパイル時間 667 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 108,672 KB
最終ジャッジ日時 2024-04-29 21:32:36
合計ジャッジ時間 5,930 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 88 ms
82,816 KB
testcase_04 AC 138 ms
108,672 KB
testcase_05 AC 137 ms
108,672 KB
testcase_06 AC 137 ms
108,288 KB
testcase_07 WA -
testcase_08 AC 100 ms
106,880 KB
testcase_09 AC 99 ms
107,392 KB
testcase_10 AC 99 ms
107,264 KB
testcase_11 AC 107 ms
101,760 KB
testcase_12 AC 109 ms
101,888 KB
testcase_13 AC 110 ms
102,016 KB
testcase_14 AC 108 ms
101,760 KB
testcase_15 AC 121 ms
101,760 KB
testcase_16 AC 118 ms
102,016 KB
testcase_17 AC 118 ms
102,144 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 40 ms
51,712 KB
testcase_26 AC 40 ms
51,328 KB
testcase_27 AC 41 ms
51,712 KB
testcase_28 AC 40 ms
51,584 KB
testcase_29 AC 40 ms
51,840 KB
testcase_30 AC 40 ms
51,456 KB
testcase_31 AC 40 ms
51,328 KB
testcase_32 AC 41 ms
51,328 KB
testcase_33 AC 40 ms
51,968 KB
testcase_34 AC 40 ms
51,456 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