結果
| 問題 |
No.1805 Approaching Many Typhoon
|
| ユーザー |
|
| 提出日時 | 2022-01-13 21:42:44 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 38 ms / 2,000 ms |
| コード長 | 561 bytes |
| コンパイル時間 | 247 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-11-17 14:53:39 |
| 合計ジャッジ時間 | 2,811 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 35 |
ソースコード
from collections import defaultdict, deque
n, m = map(int, input().split())
s, g = map(int, input().split())
edge = defaultdict(list)
for _ in range(m):
f, t = map(int, input().split())
edge[f].append(t)
edge[t].append(f)
_ = int(input())
seen = set(map(int, input().split()))
seen.add(s)
Que = deque([s])
while Que:
curr = Que.popleft()
if curr == g:
print("Yes")
exit()
for np in edge[curr]:
if np in seen:
continue
seen.add(np)
Que.append(np)
print("No")