結果
問題 |
No.2780 The Bottle Imp
|
ユーザー |
|
提出日時 | 2024-06-07 23:15:29 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 333 bytes |
コンパイル時間 | 368 ms |
コンパイル使用メモリ | 81,664 KB |
実行使用メモリ | 83,584 KB |
最終ジャッジ日時 | 2024-12-27 14:32:01 |
合計ジャッジ時間 | 7,552 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 31 WA * 9 |
ソースコード
n=int(input()) uf=[*range(n)] def find(x): q=[] while uf[x]^x:q+=x,;x=uf[x] for p in q:uf[p]=x return x def unite(x,y): x,y=find(x),find(y) if x^y:uf[x]=y for i in range(n): m,*a=map(int,input().split()) for j in a: unite(i,j-1) s=set() for i in range(n): s|={find(i)} if len(s)==1: print('Yes') else: print('No')