結果

問題 No.2780 The Bottle Imp
ユーザー norioc
提出日時 2024-06-07 23:06:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 425 bytes
コンパイル時間 251 ms
コンパイル使用メモリ 82,340 KB
実行使用メモリ 198,812 KB
最終ジャッジ日時 2024-12-27 14:30:35
合計ジャッジ時間 8,188 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 36 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
import sys
sys.setrecursionlimit(10 ** 6)

N = int(input())
adj = defaultdict(list)
for i in range(N):
    M, *A = list(map(int, input().split()))
    for a in A:
        adj[i].append(a-1)


def dfs(v, used):
    if used[v]: return
    used[v] = True

    for to in adj[v]:
        dfs(to, used)


used = [False] * N
dfs(0, used)
if sum(used) == N:
    print('Yes')
else:
    print('No')
0