結果

問題 No.1687 What the Heck?
ユーザー Mik10Mik10
提出日時 2021-10-06 15:39:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 413 ms / 2,000 ms
コード長 329 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 87,012 KB
実行使用メモリ 116,344 KB
最終ジャッジ日時 2023-09-30 08:47:17
合計ジャッジ時間 5,906 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,244 KB
testcase_01 AC 67 ms
71,204 KB
testcase_02 AC 69 ms
71,236 KB
testcase_03 AC 69 ms
71,108 KB
testcase_04 AC 69 ms
70,940 KB
testcase_05 AC 69 ms
70,940 KB
testcase_06 AC 70 ms
71,188 KB
testcase_07 AC 172 ms
96,048 KB
testcase_08 AC 207 ms
99,864 KB
testcase_09 AC 174 ms
96,020 KB
testcase_10 AC 127 ms
84,364 KB
testcase_11 AC 137 ms
89,664 KB
testcase_12 AC 412 ms
116,280 KB
testcase_13 AC 413 ms
115,932 KB
testcase_14 AC 410 ms
115,860 KB
testcase_15 AC 412 ms
115,996 KB
testcase_16 AC 413 ms
116,344 KB
testcase_17 AC 89 ms
76,468 KB
testcase_18 AC 410 ms
115,936 KB
testcase_19 AC 78 ms
76,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
suzu = list(map(int, input().split()))
p = ptotal = draw = ans = 0
ptlst = []
for i in suzu:
    p += 1
    ptlst.append([i, p])
    ptotal += p
ptlst.sort(key=lambda x:x[0])

for i in range(n-1, 0, -1):
    pt = ptotal - ptlst[i][1]*2 - draw
    draw += ptlst[i][1]
    ans = pt if ans < pt else ans
print (ans)
0