結果

問題 No.1805 Approaching Many Typhoon
ユーザー 👑 Kazun
提出日時 2022-01-12 21:53:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 480 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 82,372 KB
実行使用メモリ 71,268 KB
最終ジャッジ日時 2024-11-15 15:06:41
合計ジャッジ時間 2,973 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30 WA * 5
権限があれば一括ダウンロードができます

ソースコード

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)

U=int(input())
I=list(map(int,input().split()))

P=[0]*(N+1)
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[T] else "No")
0