結果
問題 | No.1805 Approaching Many Typhoon |
ユーザー |
![]() |
提出日時 | 2022-09-01 19:10:23 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 37 ms / 2,000 ms |
コード長 | 572 bytes |
コンパイル時間 | 208 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-11-14 10:20:57 |
合計ジャッジ時間 | 2,653 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 35 |
ソースコード
from collections import dequen,m=map(int,input().split())s,g=map(int,input().split())G=[[] for i in range(n)]for i in range(m):a,b=map(int,input().split())G[a-1].append(b-1)G[b-1].append(a-1)u=input()A=list(map(int,input().split()))seen=[False]*ndeq=deque([])deq.append(s-1)seen[s-1]=Truefor x in A:seen[x-1]="NG"while len(deq):v=deq.popleft()for v2 in G[v]:if seen[v2] or seen[v2]=="NG":continuedeq.append(v2)seen[v2]=Trueif seen[g-1]:print("Yes")else:print("No")