結果

問題 No.1687 What the Heck?
ユーザー 👑 rin204
提出日時 2022-01-18 02:42:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 216 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 82,428 KB
実行使用メモリ 104,960 KB
最終ジャッジ日時 2024-11-23 13:11:03
合計ジャッジ時間 2,388 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
P = list(map(int, input().split()))
Q = [0] * n
for i, p in enumerate(P, 1):
    Q[p - 1] = i
    
tot = 0
ans = 0
for i in range(n - 1):
    tot += Q[i]
    ans = max(ans, tot - Q[i + 1])
print(ans)
0