結果

問題 No.1687 What the Heck?
ユーザー Kude
提出日時 2021-09-24 21:29:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 90 ms / 2,000 ms
コード長 242 bytes
コンパイル時間 144 ms
コンパイル使用メモリ 82,132 KB
実行使用メモリ 105,216 KB
最終ジャッジ日時 2024-07-05 10:03:56
合計ジャッジ時間 2,089 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
p = list(map(int, input().split()))
ord = [0] * n
for i, x in enumerate(p, 1):
    ord[x - 1] = i

ans = 0
now = 0
for i in range(n - 1):
    now += ord[i] - ord[i + 1]
    ans = max(ans, now)
    now += ord[i + 1]
print(ans)
0