結果

問題 No.1449 新プロランド
ユーザー nasubi24nasubi24
提出日時 2021-03-31 15:34:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 420 ms / 2,000 ms
コード長 748 bytes
コンパイル時間 1,001 ms
コンパイル使用メモリ 86,988 KB
実行使用メモリ 109,540 KB
最終ジャッジ日時 2023-08-25 16:49:03
合計ジャッジ時間 7,328 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
77,944 KB
testcase_01 AC 118 ms
78,380 KB
testcase_02 AC 139 ms
79,260 KB
testcase_03 AC 113 ms
78,352 KB
testcase_04 AC 114 ms
78,232 KB
testcase_05 AC 420 ms
109,540 KB
testcase_06 AC 276 ms
94,316 KB
testcase_07 AC 275 ms
97,772 KB
testcase_08 AC 251 ms
96,556 KB
testcase_09 AC 204 ms
81,804 KB
testcase_10 AC 327 ms
104,836 KB
testcase_11 AC 164 ms
89,652 KB
testcase_12 AC 248 ms
94,920 KB
testcase_13 AC 272 ms
87,148 KB
testcase_14 AC 166 ms
90,016 KB
testcase_15 AC 264 ms
93,600 KB
testcase_16 AC 207 ms
85,524 KB
testcase_17 AC 225 ms
88,356 KB
testcase_18 AC 103 ms
78,056 KB
testcase_19 AC 100 ms
77,308 KB
testcase_20 AC 99 ms
76,544 KB
testcase_21 AC 150 ms
86,308 KB
testcase_22 AC 134 ms
79,564 KB
testcase_23 AC 187 ms
90,908 KB
testcase_24 AC 211 ms
82,900 KB
testcase_25 AC 133 ms
79,140 KB
testcase_26 AC 114 ms
78,120 KB
testcase_27 AC 318 ms
102,152 KB
testcase_28 AC 217 ms
85,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
n,m=map(int,input().split())
ans=[[10**10]*(11**4+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**4+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