結果

問題 No.1449 新プロランド
ユーザー ああいいああいい
提出日時 2022-06-03 08:13:20
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 791 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 87,172 KB
実行使用メモリ 81,824 KB
最終ジャッジ日時 2023-08-25 16:53:48
合計ジャッジ時間 4,537 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,588 KB
testcase_01 AC 75 ms
71,400 KB
testcase_02 AC 78 ms
71,048 KB
testcase_03 AC 75 ms
71,348 KB
testcase_04 AC 75 ms
71,268 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 77 ms
71,056 KB
testcase_08 RE -
testcase_09 AC 77 ms
71,048 KB
testcase_10 AC 75 ms
71,288 KB
testcase_11 AC 75 ms
71,204 KB
testcase_12 RE -
testcase_13 AC 77 ms
71,340 KB
testcase_14 AC 75 ms
71,412 KB
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 77 ms
71,376 KB
testcase_19 AC 75 ms
71,524 KB
testcase_20 AC 75 ms
71,352 KB
testcase_21 AC 75 ms
71,272 KB
testcase_22 AC 75 ms
71,412 KB
testcase_23 AC 75 ms
71,284 KB
testcase_24 AC 76 ms
71,548 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 RE -
testcase_28 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
G = [[] for _ in range(N)]
for _ in range(M):
    a,b,c = map(int,input().split())
    a -= 1
    b -= 1
    G[a].append((b,c))
    G[b].append((a,c))
T = list(map(int,input().split()))
inf = 1000
dist = [[10 ** 6] * (inf + 1) for _ in range(N)]
dist[0][T[0]] = 0
q = [(0,0,0)]
import heapq
while q:
    d,now,time = heapq.heappop(q)
    #print(d,now,time)
    if dist[now][time] < d:contnue
    if now == N - 1:break
    time += T[now]
    d += T[now]
    if time > inf:
        time = inf
    for v,c in G[now]:
        tmp = d + c // time
        if dist[v][time] > tmp:
            dist[v][time] = tmp
            heapq.heappush(q,(tmp,v,time))
ans = 10 ** 6
for time in range(inf + 1):
    if ans > dist[-1][time]:
        ans = dist[-1][time]
print(ans)
0