結果

問題 No.1805 Approaching Many Typhoon
ユーザー 👑 KazunKazun
提出日時 2022-01-12 22:05:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 68 ms / 2,000 ms
コード長 500 bytes
コンパイル時間 236 ms
コンパイル使用メモリ 81,896 KB
実行使用メモリ 71,388 KB
最終ジャッジ日時 2024-04-27 12:58:41
合計ジャッジ時間 2,907 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
54,596 KB
testcase_01 AC 37 ms
54,748 KB
testcase_02 AC 39 ms
54,660 KB
testcase_03 AC 39 ms
54,504 KB
testcase_04 AC 43 ms
53,744 KB
testcase_05 AC 40 ms
54,520 KB
testcase_06 AC 39 ms
54,744 KB
testcase_07 AC 39 ms
54,280 KB
testcase_08 AC 40 ms
54,584 KB
testcase_09 AC 42 ms
54,736 KB
testcase_10 AC 38 ms
54,948 KB
testcase_11 AC 37 ms
55,028 KB
testcase_12 AC 41 ms
53,856 KB
testcase_13 AC 40 ms
54,232 KB
testcase_14 AC 41 ms
54,084 KB
testcase_15 AC 39 ms
54,488 KB
testcase_16 AC 40 ms
54,196 KB
testcase_17 AC 39 ms
53,788 KB
testcase_18 AC 39 ms
53,884 KB
testcase_19 AC 38 ms
53,708 KB
testcase_20 AC 39 ms
53,472 KB
testcase_21 AC 40 ms
55,400 KB
testcase_22 AC 39 ms
55,128 KB
testcase_23 AC 39 ms
54,512 KB
testcase_24 AC 38 ms
55,372 KB
testcase_25 AC 39 ms
53,816 KB
testcase_26 AC 38 ms
53,704 KB
testcase_27 AC 39 ms
53,880 KB
testcase_28 AC 68 ms
69,592 KB
testcase_29 AC 63 ms
69,784 KB
testcase_30 AC 65 ms
70,884 KB
testcase_31 AC 65 ms
71,388 KB
testcase_32 AC 41 ms
54,644 KB
testcase_33 AC 40 ms
55,140 KB
testcase_34 AC 41 ms
55,172 KB
testcase_35 AC 47 ms
57,172 KB
testcase_36 AC 52 ms
63,300 KB
testcase_37 AC 39 ms
53,892 KB
testcase_38 AC 40 ms
54,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

N,M=map(int,input().split())
S,G=map(int,input().split())

E=[[] for _ in range(N+1)]
for _ in range(M):
    F,T=map(int,input().split())
    E[F].append(T)
    E[T].append(F)

P=[0]*(N+1)

U=int(input())
if U>0:
    I=list(map(int,input().split()))
    for i in I:
        P[i]=1

Q=deque([S])
X=[0]*(N+1); X[S]=1

while Q:
    u=Q.popleft()
    for v in E[u]:
        if P[v]==0 and X[v]==0:
            X[v]=1
            Q.append(v)

print("Yes" if X[G] else "No")
0