結果

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

ソースコード

diff #

from collections import defaultdict

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