結果

問題 No.1687 What the Heck?
ユーザー None
提出日時 2021-10-06 02:20:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 197 bytes
コンパイル時間 437 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 106,812 KB
最終ジャッジ日時 2024-07-23 02:40:46
合計ジャッジ時間 2,335 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 8 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
P=list(map(lambda x:x-1,map(int, input().split())))
Q=[0]*N
for i,p in enumerate(P):
    Q[p]=i
res=0
for n in range(N)[::-1]:
    res=max((n+1)*(n+2)//2 - 2*(Q[n]+1),res)
print(res)
0