結果
| 問題 | No.1805 Approaching Many Typhoon |
| ユーザー |
|
| 提出日時 | 2022-01-13 21:42:44 |
| 言語 | Python3 (3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 25 ms / 2,000 ms |
| + 164µs | |
| コード長 | 561 bytes |
| 記録 | |
| コンパイル時間 | 96 ms |
| コンパイル使用メモリ | 14,592 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2026-10-26 17:57:12 |
| 合計ジャッジ時間 | 2,946 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge7_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 36 |
ソースコード
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")