結果

問題 No.1805 Approaching Many Typhoon
ユーザー irumo8202
提出日時 2022-01-27 11:16:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 586 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 82,224 KB
実行使用メモリ 70,864 KB
最終ジャッジ日時 2024-12-24 20:13:23
合計ジャッジ時間 3,335 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
S, G = map(lambda x: int(x) - 1, input().split())

graph = [[] for _ in range(N)]

for _ in range(M):
    f, t = map(lambda x: int(x) - 1, input().split())
    graph[f].append(t)
    graph[t].append(f)

input()
dont_use = set(map(lambda x: int(x) - 1, input().split()))

que = [S]
visited = [False] * N
visited[S] = True
while que:
    v = que.pop()
    for nx in graph[v]:
        if visited[nx]:
            continue
        if nx in dont_use:
            continue
        visited[nx] = True
        que.append(nx)
print("YNeos"[1 ^ visited[G] :: 2])
0