結果

問題 No.1687 What the Heck?
ユーザー puzneko
提出日時 2021-11-23 22:38:12
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 734 ms / 2,000 ms
コード長 266 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 45,912 KB
最終ジャッジ日時 2024-06-25 20:21:09
合計ジャッジ時間 7,874 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin

n, *a = map(int, stdin.read().split())
asort = []
for i in range(n):
    asort.append((-a[i],i+1))
asort.sort()

ans = 0
val = n * (n+1) // 2
for i in range(n):
    val -= asort[i][1]
    ans = max(ans,val-asort[i][1])
print("{}".format(ans))
0