結果

問題 No.1805 Approaching Many Typhoon
ユーザー 330Xs330Xs
提出日時 2022-01-30 15:28:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 679 bytes
コンパイル時間 765 ms
コンパイル使用メモリ 87,208 KB
実行使用メモリ 78,460 KB
最終ジャッジ日時 2023-09-02 01:39:23
合計ジャッジ時間 6,309 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
71,900 KB
testcase_01 AC 88 ms
71,832 KB
testcase_02 AC 84 ms
71,756 KB
testcase_03 AC 87 ms
71,988 KB
testcase_04 AC 85 ms
71,896 KB
testcase_05 AC 86 ms
71,980 KB
testcase_06 AC 84 ms
71,976 KB
testcase_07 AC 84 ms
71,772 KB
testcase_08 AC 88 ms
71,840 KB
testcase_09 AC 84 ms
71,652 KB
testcase_10 AC 86 ms
71,992 KB
testcase_11 AC 85 ms
71,780 KB
testcase_12 AC 87 ms
71,768 KB
testcase_13 AC 85 ms
71,828 KB
testcase_14 AC 83 ms
71,948 KB
testcase_15 AC 87 ms
71,968 KB
testcase_16 AC 86 ms
71,704 KB
testcase_17 AC 89 ms
71,652 KB
testcase_18 AC 84 ms
71,404 KB
testcase_19 AC 85 ms
71,452 KB
testcase_20 AC 87 ms
71,812 KB
testcase_21 AC 86 ms
71,656 KB
testcase_22 AC 86 ms
71,824 KB
testcase_23 AC 86 ms
71,904 KB
testcase_24 AC 86 ms
71,660 KB
testcase_25 AC 88 ms
71,648 KB
testcase_26 AC 86 ms
71,920 KB
testcase_27 AC 87 ms
71,580 KB
testcase_28 AC 112 ms
77,876 KB
testcase_29 AC 115 ms
77,952 KB
testcase_30 AC 112 ms
78,460 KB
testcase_31 AC 111 ms
78,104 KB
testcase_32 AC 88 ms
71,704 KB
testcase_33 AC 90 ms
71,896 KB
testcase_34 AC 89 ms
72,436 KB
testcase_35 AC 94 ms
72,096 KB
testcase_36 AC 100 ms
76,240 KB
testcase_37 AC 87 ms
71,924 KB
testcase_38 AC 85 ms
71,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
n,m = map(int,input().split())
a,b = map(int,input().split())
to = [[] for _ in range(n)]
for _ in range(m):
    f,t = map(int,input().split())
    to[f-1].append(t-1)
    to[t-1].append(f-1)
    
u = int(input())
if(u != 0):
    i = list(map(int,input().split()))
    i = list(map(lambda x:x-1,i))
    i = set(i)
else:
    i = set()

visited = [False] * n
que = deque()
que.append(a-1)
visited[a-1] = True
while(que):
    c = que.popleft()
    for v in to[c]:
        if((visited[v] == False) & (v not in i)):
            visited[v] = True
            que.append(v)
            
if(visited[b-1]):
    print('Yes')
else:
    print('No')
            
0