結果

問題 No.1687 What the Heck?
ユーザー pluto77
提出日時 2022-02-08 10:56:22
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 330 ms / 2,000 ms
コード長 181 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 41,072 KB
最終ジャッジ日時 2024-06-23 04:08:54
合計ジャッジ時間 4,273 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki1687
n=int(input())
p=list(map(int,input().split()))
d={}
for i in range(n):
 d[p[i]]=i+1
s=(n+1)*n//2
res=0
for i in range(n,0,-1):
 res=max(res,s-d[i]*2)
 s-=d[i]
print(res)
0