結果

問題 No.1449 新プロランド
ユーザー nasubi24nasubi24
提出日時 2021-03-31 19:55:15
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 764 bytes
コンパイル時間 584 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 271,244 KB
最終ジャッジ日時 2023-08-25 16:50:52
合計ジャッジ時間 20,463 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
79,408 KB
testcase_01 AC 160 ms
83,776 KB
testcase_02 AC 256 ms
86,872 KB
testcase_03 AC 126 ms
80,744 KB
testcase_04 AC 135 ms
81,896 KB
testcase_05 TLE -
testcase_06 AC 1,120 ms
189,960 KB
testcase_07 AC 1,204 ms
217,888 KB
testcase_08 AC 981 ms
206,908 KB
testcase_09 AC 660 ms
108,188 KB
testcase_10 AC 1,528 ms
269,224 KB
testcase_11 AC 422 ms
165,928 KB
testcase_12 AC 983 ms
195,308 KB
testcase_13 AC 1,078 ms
149,324 KB
testcase_14 AC 457 ms
170,052 KB
testcase_15 AC 1,041 ms
188,724 KB
testcase_16 AC 716 ms
138,852 KB
testcase_17 AC 773 ms
159,552 KB
testcase_18 AC 110 ms
79,876 KB
testcase_19 AC 137 ms
129,368 KB
testcase_20 AC 102 ms
79,176 KB
testcase_21 AC 352 ms
139,724 KB
testcase_22 AC 197 ms
87,792 KB
testcase_23 AC 619 ms
176,968 KB
testcase_24 AC 768 ms
118,876 KB
testcase_25 AC 261 ms
97,900 KB
testcase_26 AC 135 ms
81,000 KB
testcase_27 AC 1,358 ms
237,528 KB
testcase_28 AC 753 ms
133,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
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 or min(ans[-1])==10**10:
    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]<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