結果
問題 |
No.2780 The Bottle Imp
|
ユーザー |
|
提出日時 | 2024-06-08 00:13:30 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 535 bytes |
コンパイル時間 | 307 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 38,144 KB |
最終ジャッジ日時 | 2024-12-27 14:46:12 |
合計ジャッジ時間 | 10,643 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 36 WA * 4 |
ソースコード
import collections N, = map(int, input().split()) graph = collections.defaultdict(list) for i in range(1, N + 1): Mi, *neigb = map(int, input().split()) for neighbor in neigb: graph[i].append(neighbor) visited = set() queue = collections.deque([1]) while queue: node = queue.popleft() if node not in visited: visited.add(node) for neighbor in graph[node]: if neighbor not in visited: queue.append(neighbor) if len(visited) == N: print("Yes") else: print("No")