結果

問題 No.1805 Approaching Many Typhoon
ユーザー 👑 rin204rin204
提出日時 2022-01-18 00:55:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 562 bytes
コンパイル時間 544 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 68,736 KB
最終ジャッジ日時 2024-05-02 19:07:06
合計ジャッジ時間 3,308 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,968 KB
testcase_01 AC 39 ms
51,712 KB
testcase_02 WA -
testcase_03 AC 39 ms
51,968 KB
testcase_04 AC 38 ms
52,096 KB
testcase_05 WA -
testcase_06 AC 39 ms
52,096 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 39 ms
51,712 KB
testcase_11 AC 37 ms
52,096 KB
testcase_12 AC 37 ms
51,712 KB
testcase_13 AC 37 ms
51,840 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 39 ms
52,096 KB
testcase_18 WA -
testcase_19 AC 39 ms
51,840 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 39 ms
51,840 KB
testcase_23 AC 39 ms
51,712 KB
testcase_24 AC 38 ms
51,968 KB
testcase_25 AC 39 ms
51,840 KB
testcase_26 AC 39 ms
51,968 KB
testcase_27 WA -
testcase_28 AC 69 ms
68,352 KB
testcase_29 AC 70 ms
68,352 KB
testcase_30 AC 69 ms
67,968 KB
testcase_31 AC 72 ms
68,736 KB
testcase_32 AC 41 ms
52,736 KB
testcase_33 AC 41 ms
52,608 KB
testcase_34 AC 44 ms
53,248 KB
testcase_35 AC 47 ms
54,912 KB
testcase_36 WA -
testcase_37 AC 38 ms
52,096 KB
testcase_38 AC 35 ms
51,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
s, g = map(int, input().split())
s -= 1
g -= 1
edges = [[] for _ in range(n)]
for _ in range(m):
    f, t = map(int, input().split())
    f -= 1
    t -= 1
    edges[f].append(t)
    edges[t].append(f)
    
u = int(input())
ng = set(map(int, input().split()))
ok = [False] * n
ok[s] = True
stack = [s]
while stack:
    pos = stack.pop()
    for npos in edges[pos]:
        if ok[npos] or npos in ng:
            continue
        ok[npos] = True
        stack.append(npos)
if ok[g]:
    print("Yes")
else:
    print("No")
        
0