結果

問題 No.2780 The Bottle Imp
ユーザー manoto43manoto43
提出日時 2024-06-07 22:54:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 566 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 123,260 KB
最終ジャッジ日時 2024-06-08 10:36:36
合計ジャッジ時間 8,869 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
53,376 KB
testcase_01 AC 42 ms
53,504 KB
testcase_02 AC 42 ms
53,248 KB
testcase_03 AC 43 ms
53,632 KB
testcase_04 AC 44 ms
53,376 KB
testcase_05 AC 43 ms
53,632 KB
testcase_06 AC 42 ms
53,376 KB
testcase_07 AC 246 ms
103,020 KB
testcase_08 AC 243 ms
102,520 KB
testcase_09 AC 234 ms
102,656 KB
testcase_10 AC 255 ms
102,368 KB
testcase_11 AC 249 ms
102,700 KB
testcase_12 AC 288 ms
114,268 KB
testcase_13 AC 336 ms
122,360 KB
testcase_14 AC 137 ms
84,736 KB
testcase_15 AC 139 ms
84,736 KB
testcase_16 WA -
testcase_17 AC 137 ms
84,736 KB
testcase_18 AC 137 ms
84,480 KB
testcase_19 AC 139 ms
84,224 KB
testcase_20 AC 135 ms
84,224 KB
testcase_21 WA -
testcase_22 AC 164 ms
85,632 KB
testcase_23 AC 139 ms
84,736 KB
testcase_24 AC 233 ms
98,220 KB
testcase_25 AC 300 ms
113,908 KB
testcase_26 AC 214 ms
94,336 KB
testcase_27 AC 164 ms
104,112 KB
testcase_28 AC 169 ms
103,852 KB
testcase_29 WA -
testcase_30 AC 130 ms
89,472 KB
testcase_31 AC 252 ms
120,872 KB
testcase_32 AC 85 ms
77,952 KB
testcase_33 AC 239 ms
123,260 KB
testcase_34 AC 244 ms
123,036 KB
testcase_35 AC 90 ms
77,824 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 87 ms
77,440 KB
testcase_39 AC 203 ms
119,276 KB
testcase_40 AC 207 ms
119,036 KB
testcase_41 WA -
testcase_42 AC 43 ms
53,376 KB
testcase_43 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict,deque

def main():
    N = int(input())
    d = defaultdict(set)

    for i in range(N):
        que = list(map(int, input().split()))
        d[i+1] = set(que[1:])
        for q in que[1:]:
            d[q].add(i+1)
    
    que = deque([1])
    s = set([1])

    while que:
        v = que.popleft()
        for u in d[v]:
            if u not in s:
                s.add(u)
                que.append(u)
    
    if len(s) == N:
        print("Yes")
    else:
        print("No")
        

if __name__ == "__main__":
    main()
0