結果

問題 No.1805 Approaching Many Typhoon
ユーザー 330Xs330Xs
提出日時 2022-01-30 15:07:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 629 bytes
コンパイル時間 896 ms
コンパイル使用メモリ 86,816 KB
実行使用メモリ 78,440 KB
最終ジャッジ日時 2023-09-02 01:38:10
合計ジャッジ時間 7,382 ms
ジャッジサーバーID
(参考情報)
judge16 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,800 KB
testcase_01 AC 92 ms
71,404 KB
testcase_02 WA -
testcase_03 AC 91 ms
71,620 KB
testcase_04 AC 93 ms
71,608 KB
testcase_05 WA -
testcase_06 AC 91 ms
71,856 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 92 ms
71,572 KB
testcase_11 AC 90 ms
71,644 KB
testcase_12 AC 92 ms
71,568 KB
testcase_13 AC 93 ms
71,720 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 91 ms
71,544 KB
testcase_18 WA -
testcase_19 AC 91 ms
71,568 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 92 ms
71,824 KB
testcase_23 AC 92 ms
71,820 KB
testcase_24 AC 93 ms
71,412 KB
testcase_25 AC 93 ms
71,772 KB
testcase_26 AC 92 ms
71,772 KB
testcase_27 WA -
testcase_28 AC 117 ms
78,436 KB
testcase_29 AC 118 ms
78,328 KB
testcase_30 AC 118 ms
78,440 KB
testcase_31 AC 118 ms
78,144 KB
testcase_32 AC 94 ms
71,800 KB
testcase_33 AC 94 ms
71,860 KB
testcase_34 AC 98 ms
72,368 KB
testcase_35 AC 102 ms
72,356 KB
testcase_36 WA -
testcase_37 AC 92 ms
71,508 KB
testcase_38 AC 91 ms
71,648 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 = set(map(int,input().split()))
else:
    i = set()

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