結果
問題 |
No.1390 Get together
|
ユーザー |
|
提出日時 | 2025-01-11 09:36:58 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 328 bytes |
コンパイル時間 | 326 ms |
コンパイル使用メモリ | 81,408 KB |
実行使用メモリ | 66,896 KB |
最終ジャッジ日時 | 2025-01-11 09:37:03 |
合計ジャッジ時間 | 4,886 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 29 |
ソースコード
from atcoder.dsu import DSU N,M=map(int,input().split()) uni=DSU(M) color=[[] for i in range(N+1)] for i in range(N): b,c=map(int,input().split()) color[c].append(b-1) for c in color: for i in range(len(c)-1): uni.merge(c[i],c[i+1]) ans=M for i in range(M): if uni.leader(i)==i: ans-=1 print(ans)