結果

問題 No.1382 Travel in Mitaru city
ユーザー O2MTO2MT
提出日時 2021-02-08 11:50:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 763 bytes
コンパイル時間 1,103 ms
コンパイル使用メモリ 86,504 KB
実行使用メモリ 833,044 KB
最終ジャッジ日時 2023-09-18 18:16:34
合計ジャッジ時間 9,180 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
71,348 KB
testcase_01 AC 96 ms
71,380 KB
testcase_02 AC 93 ms
71,308 KB
testcase_03 AC 93 ms
71,500 KB
testcase_04 AC 94 ms
71,464 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 MLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
testcase_63 -- -
testcase_64 -- -
testcase_65 -- -
testcase_66 -- -
testcase_67 -- -
testcase_68 -- -
testcase_69 -- -
testcase_70 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
N,M,S,T = map(int,input().split())
S -= 1
T -= 1
P = list(map(int,input().split()))
l = [[] for _ in range(N)]
for _ in range(M):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    l[a].append(b)
    l[b].append(a)

st = deque([(S,P[S],0)])
X,Y = 0,0
while st:
    i,x,y = st.popleft()
    if i == T:
        X,Y = x,y
        break
    for j in l[i]:
        if P[j] < x:
            x = P[j]
            y += 1
        st.append((j,x,y))

st = deque([(T,X,Y)])
visited = [False]*N
while st:
    i,x,y = st.popleft()
    Y = max(Y,y)
    for j in l[i]:
        if not visited[j]:
            visited[j] = True
            if P[j] < x:
                x = P[j]
                y += 1
            st.append((j,x,y))
print(Y)
0