結果

問題 No.1805 Approaching Many Typhoon
ユーザー 👑 Kazun
提出日時 2022-01-12 22:05:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 500 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 70,144 KB
最終ジャッジ日時 2024-11-15 15:07:01
合計ジャッジ時間 3,528 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

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