結果

問題 No.1449 新プロランド
ユーザー nasubi24nasubi24
提出日時 2021-03-31 15:39:22
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 748 bytes
コンパイル時間 471 ms
コンパイル使用メモリ 87,124 KB
実行使用メモリ 273,612 KB
最終ジャッジ日時 2023-08-25 16:49:46
合計ジャッジ時間 21,294 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
79,232 KB
testcase_01 AC 164 ms
83,468 KB
testcase_02 AC 269 ms
88,404 KB
testcase_03 AC 128 ms
80,704 KB
testcase_04 AC 138 ms
82,128 KB
testcase_05 TLE -
testcase_06 AC 1,166 ms
196,696 KB
testcase_07 AC 1,271 ms
226,612 KB
testcase_08 AC 1,029 ms
211,936 KB
testcase_09 AC 700 ms
110,200 KB
testcase_10 AC 1,644 ms
273,612 KB
testcase_11 AC 446 ms
170,812 KB
testcase_12 AC 1,026 ms
201,860 KB
testcase_13 AC 1,148 ms
152,380 KB
testcase_14 AC 480 ms
173,524 KB
testcase_15 AC 1,081 ms
193,068 KB
testcase_16 AC 755 ms
142,220 KB
testcase_17 AC 817 ms
163,456 KB
testcase_18 AC 113 ms
80,296 KB
testcase_19 AC 147 ms
131,776 KB
testcase_20 AC 105 ms
79,236 KB
testcase_21 AC 371 ms
142,100 KB
testcase_22 AC 203 ms
87,732 KB
testcase_23 AC 662 ms
181,628 KB
testcase_24 AC 818 ms
120,908 KB
testcase_25 AC 275 ms
98,528 KB
testcase_26 AC 140 ms
80,924 KB
testcase_27 AC 1,439 ms
244,992 KB
testcase_28 AC 786 ms
135,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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