結果

問題 No.1449 新プロランド
ユーザー nasubi24nasubi24
提出日時 2021-03-31 15:38:54
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 748 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 87,020 KB
実行使用メモリ 302,540 KB
最終ジャッジ日時 2023-08-25 16:49:13
合計ジャッジ時間 4,959 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
80,476 KB
testcase_01 AC 195 ms
88,324 KB
testcase_02 AC 347 ms
94,336 KB
testcase_03 AC 136 ms
84,076 KB
testcase_04 AC 153 ms
85,636 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
n,m=map(int,input().split())
ans=[[10**10]*(11**5+200) for _ in range(n)]
num=[[] for _ in range(n)]
for i in range(m):
    a,b,c=map(int,input().split())
    num[a-1].append([b-1,c])
    num[b-1].append([a-1,c])
t=list(map(int,input().split()))
ans[0][t[0]]=t[0]
queue=deque()
queue.append([0,t[0]])
seen=[False]*n
seen[0]=True
while len(queue)!=0:
    num1=queue.popleft()
    h1=num1[0]
    h2=num1[1]
    num2=num[h1]
    seen[h1]=True
    num3=ans[h1][h2]
    for i in range(len(num2)):
        j=num2[i][0]
        if h2+t[j]<11**5+200:
       	    cnt=num3+num2[i][1]//h2+t[j]
            if ans[j][h2+t[j]]>cnt:
                ans[j][h2+t[j]]=cnt
                queue.append([j,h2+t[j]])
print(min(ans[-1]))
0