結果
| 問題 |
No.1805 Approaching Many Typhoon
|
| ユーザー |
|
| 提出日時 | 2022-01-27 11:16:07 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 75 ms / 2,000 ms |
| コード長 | 586 bytes |
| コンパイル時間 | 313 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 70,016 KB |
| 最終ジャッジ日時 | 2024-12-24 20:14:09 |
| 合計ジャッジ時間 | 3,438 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 35 |
ソースコード
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])