結果

問題 No.1687 What the Heck?
ユーザー ntuda
提出日時 2025-01-30 18:26:15
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 235 bytes
コンパイル時間 416 ms
コンパイル使用メモリ 82,040 KB
実行使用メモリ 106,692 KB
最終ジャッジ日時 2025-01-30 18:26:19
合計ジャッジ時間 3,089 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
P = list(map(int,input().split()))
for i in reversed(range(N)):
    if P[i] == i + 1:
        P.pop()
        N -= 1
if P:
    sumn = N * (N + 1) // 2
    cp = P.index(N) + 1
    print(sumn - cp * 2)
else:
    print(0)
0