結果
問題 |
No.2780 The Bottle Imp
|
ユーザー |
![]() |
提出日時 | 2024-06-11 08:58:19 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 503 bytes |
コンパイル時間 | 334 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 91,716 KB |
最終ジャッジ日時 | 2024-06-11 08:58:27 |
合計ジャッジ時間 | 8,184 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 36 WA * 4 |
ソースコード
from collections import defaultdict N = int(input()) edge = defaultdict(list) for i in range(1,N+1): A = list(map(int, input().split()))[1:] edge[i] = A def dfs(start): todo = [start,] seen = [False] * (N+1) while todo: tgt = todo.pop() if seen[tgt]: continue seen[tgt] = True for next in edge[tgt]: todo.append(next) return seen connected = dfs(1) if(all(connected[1:])): print("Yes") else: print("No")