結果
問題 | No.3091 The Little Match Boy |
ユーザー |
|
提出日時 | 2025-03-05 17:57:29 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 120 ms / 2,000 ms |
コード長 | 244 bytes |
コンパイル時間 | 782 ms |
コンパイル使用メモリ | 82,576 KB |
実行使用メモリ | 109,232 KB |
最終ジャッジ日時 | 2025-03-05 17:57:39 |
合計ジャッジ時間 | 8,742 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 62 |
ソースコード
N,M=map(int,input().split()) S=list(map(int,input().split())) P=[i for i in range(N)] se=set() for i in range(M): x=S[i]-1 y=S[i] se.add((P[x],P[y])) se.add((P[y],P[x])) P[x],P[y]=P[y],P[x] print(len(se)//2)