結果

問題 No.1449 新プロランド
ユーザー nasubi24nasubi24
提出日時 2021-03-31 15:30:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 720 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 87,300 KB
実行使用メモリ 77,376 KB
最終ジャッジ日時 2023-08-25 16:48:41
合計ジャッジ時間 4,498 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
76,376 KB
testcase_01 AC 108 ms
76,440 KB
testcase_02 AC 97 ms
76,428 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 101 ms
77,084 KB
testcase_06 AC 102 ms
76,804 KB
testcase_07 AC 100 ms
76,976 KB
testcase_08 AC 103 ms
76,800 KB
testcase_09 AC 101 ms
76,972 KB
testcase_10 AC 99 ms
76,972 KB
testcase_11 AC 100 ms
76,808 KB
testcase_12 AC 100 ms
76,960 KB
testcase_13 AC 100 ms
77,192 KB
testcase_14 AC 100 ms
76,932 KB
testcase_15 AC 99 ms
76,776 KB
testcase_16 AC 100 ms
76,976 KB
testcase_17 AC 99 ms
76,976 KB
testcase_18 AC 97 ms
76,396 KB
testcase_19 AC 98 ms
77,212 KB
testcase_20 AC 97 ms
76,488 KB
testcase_21 AC 100 ms
77,080 KB
testcase_22 AC 99 ms
76,616 KB
testcase_23 AC 101 ms
76,804 KB
testcase_24 WA -
testcase_25 AC 101 ms
76,760 KB
testcase_26 WA -
testcase_27 AC 101 ms
76,936 KB
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
n,m=map(int,input().split())
ans=[[10**10]*(10**4+10) 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]
        cnt=num3+num2[i][1]//h2+t[j]
        if ans[j][h2+t[j]]>cnt and seen[j]==False:
            ans[j][h2+t[j]]=cnt
            queue.append([j,h2+t[j]])
print(min(ans[-1]))
0