結果

問題 No.1449 新プロランド
ユーザー nasubi24nasubi24
提出日時 2021-03-31 19:56:35
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 802 bytes
コンパイル時間 378 ms
コンパイル使用メモリ 86,924 KB
実行使用メモリ 153,136 KB
最終ジャッジ日時 2023-08-25 16:50:54
合計ジャッジ時間 10,856 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
84,796 KB
testcase_01 AC 111 ms
79,424 KB
testcase_02 AC 107 ms
80,724 KB
testcase_03 AC 111 ms
79,644 KB
testcase_04 AC 105 ms
79,296 KB
testcase_05 AC 674 ms
144,528 KB
testcase_06 AC 151 ms
120,320 KB
testcase_07 AC 139 ms
122,412 KB
testcase_08 AC 354 ms
148,536 KB
testcase_09 AC 123 ms
90,464 KB
testcase_10 AC 151 ms
135,620 KB
testcase_11 AC 152 ms
142,848 KB
testcase_12 AC 1,312 ms
137,180 KB
testcase_13 AC 131 ms
98,884 KB
testcase_14 AC 152 ms
146,140 KB
testcase_15 AC 148 ms
126,428 KB
testcase_16 AC 151 ms
104,416 KB
testcase_17 AC 528 ms
120,644 KB
testcase_18 AC 104 ms
78,496 KB
testcase_19 AC 140 ms
127,928 KB
testcase_20 AC 102 ms
77,792 KB
testcase_21 AC 145 ms
122,612 KB
testcase_22 AC 105 ms
81,844 KB
testcase_23 AC 150 ms
140,516 KB
testcase_24 AC 583 ms
89,512 KB
testcase_25 AC 112 ms
85,756 KB
testcase_26 AC 105 ms
78,640 KB
testcase_27 TLE -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
import sys
input=sys.stdin.readline
n,m=map(int,input().split())
ans=[[10**10]*(10**5) 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:
    k=min(ans[-1])
    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]<min(k,10**5):
       	    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