結果

問題 No.1805 Approaching Many Typhoon
ユーザー とりゐ
提出日時 2022-01-12 21:11:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 453 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 82,156 KB
実行使用メモリ 70,432 KB
最終ジャッジ日時 2024-11-15 15:05:45
合計ジャッジ時間 2,772 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

int1=lambda x:int(x)-1
n,m=map(int,input().split())
s,g=map(int1,input().split())
edge=[[] for i in range(n)]
for _ in range(m):
  u,v=map(int1,input().split())
  edge[u].append(v)
  edge[v].append(u)
u=int(input())
I=map(int1,input().split())
ng=[True]*n
for i in I:
  ng[i]=False
seen=[True]*n
d=[s]
while d:
  x=d.pop()
  if x==g:
    print('Yes')
    exit()
  seen[x]=False
  for i in edge[x]:
    if seen[i] and ng[i]:
      d.append(i)
print('No')
0