結果

問題 No.1805 Approaching Many Typhoon
ユーザー 330Xs330Xs
提出日時 2022-01-30 15:23:16
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 757 bytes
コンパイル時間 393 ms
コンパイル使用メモリ 87,256 KB
実行使用メモリ 78,340 KB
最終ジャッジ日時 2023-09-02 01:39:15
合計ジャッジ時間 5,605 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
71,600 KB
testcase_01 AC 85 ms
71,604 KB
testcase_02 WA -
testcase_03 AC 84 ms
71,776 KB
testcase_04 AC 84 ms
71,564 KB
testcase_05 WA -
testcase_06 AC 83 ms
71,820 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 85 ms
71,596 KB
testcase_11 AC 85 ms
71,944 KB
testcase_12 AC 86 ms
71,648 KB
testcase_13 AC 85 ms
71,824 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 84 ms
71,524 KB
testcase_18 WA -
testcase_19 AC 87 ms
71,804 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 85 ms
71,932 KB
testcase_23 AC 85 ms
71,612 KB
testcase_24 AC 84 ms
71,564 KB
testcase_25 AC 84 ms
71,408 KB
testcase_26 AC 84 ms
71,740 KB
testcase_27 WA -
testcase_28 AC 116 ms
78,232 KB
testcase_29 AC 116 ms
78,328 KB
testcase_30 AC 117 ms
78,312 KB
testcase_31 AC 118 ms
78,340 KB
testcase_32 AC 88 ms
71,696 KB
testcase_33 AC 88 ms
71,724 KB
testcase_34 AC 91 ms
72,432 KB
testcase_35 AC 99 ms
77,264 KB
testcase_36 WA -
testcase_37 AC 86 ms
71,412 KB
testcase_38 AC 86 ms
71,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

for j in range(n):
    for v in to[j]:
        if(v in i):
            to[j].remove(v)
            
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):
            visited[v] = True
            que.append(v)
            
if(visited[b-1]):
    print('Yes')
else:
    print('No')
            
0