結果

問題 No.1687 What the Heck?
ユーザー とりゐ
提出日時 2021-09-24 21:28:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 584 ms / 2,000 ms
コード長 187 bytes
コンパイル時間 204 ms
コンパイル使用メモリ 82,816 KB
実行使用メモリ 113,152 KB
最終ジャッジ日時 2024-07-05 10:03:47
合計ジャッジ時間 5,983 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(n):
  b.append((a[i],i+1))
b.sort()
ans=0
tmp=0
for i in range(n):
  ans=max(ans,tmp-b[i][1])
  tmp+=b[i][1]
print(ans)
0