結果

問題 No.1449 新プロランド
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-03-31 21:38:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 555 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 71,632 KB
最終ジャッジ日時 2023-08-25 16:51:05
合計ジャッジ時間 3,752 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,596 KB
testcase_01 AC 77 ms
71,388 KB
testcase_02 AC 80 ms
71,592 KB
testcase_03 WA -
testcase_04 AC 76 ms
71,332 KB
testcase_05 AC 80 ms
71,288 KB
testcase_06 AC 75 ms
71,596 KB
testcase_07 AC 76 ms
71,376 KB
testcase_08 AC 77 ms
71,632 KB
testcase_09 AC 76 ms
71,380 KB
testcase_10 AC 74 ms
71,588 KB
testcase_11 AC 76 ms
71,368 KB
testcase_12 AC 77 ms
71,180 KB
testcase_13 AC 75 ms
71,464 KB
testcase_14 AC 76 ms
71,176 KB
testcase_15 AC 77 ms
71,044 KB
testcase_16 AC 75 ms
71,412 KB
testcase_17 AC 77 ms
71,052 KB
testcase_18 AC 76 ms
71,356 KB
testcase_19 AC 75 ms
71,468 KB
testcase_20 AC 75 ms
71,340 KB
testcase_21 AC 77 ms
71,204 KB
testcase_22 AC 77 ms
71,360 KB
testcase_23 AC 75 ms
71,324 KB
testcase_24 WA -
testcase_25 AC 75 ms
71,444 KB
testcase_26 WA -
testcase_27 AC 77 ms
71,180 KB
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappush, heappop
n,m = map(int,input().split())

e = [[] for i in range(n)]
for i in range(m):
    a,b,c = map(int,input().split())
    a -= 1
    b -= 1
    e[a].append((b,c))
    e[b].append((a,c))
T = list(map(int,input().split()))

inf = 10**10
dis = [inf]*n

h = [(0,0,0)]
while h:
    d,p,now = heappop(h)
    p *= -1
    if dis[now] <= d:
        continue
    dis[now] = d
    p += T[now]
    for nex,c in e[now]:

        if dis[nex] > dis[now]+T[now]+c//p:
            heappush(h, (dis[now]+T[now]+c//p,-p,nex))
print(dis[-1])
0