結果

問題 No.3091 The Little Match Boy
ユーザー vwxyz
提出日時 2025-04-06 15:37:19
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 198 ms / 2,000 ms
コード長 241 bytes
コンパイル時間 669 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 24,712 KB
最終ジャッジ日時 2025-04-06 15:37:30
合計ジャッジ時間 7,526 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 62
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
S=list(map(int,input().split()))
perm=[i for i in range(N)]
st=set()
for s in S:
    s-=1
    perm[s],perm[s+1]=perm[s+1],perm[s]
    st.add((min(perm[s],perm[s+1]),max(perm[s],perm[s+1])))
ans=len(st)
print(ans)
0