結果

問題 No.1449 新プロランド
ユーザー ああいいああいい
提出日時 2022-06-03 08:19:31
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 792 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 87,272 KB
実行使用メモリ 80,720 KB
最終ジャッジ日時 2023-08-25 16:53:52
合計ジャッジ時間 4,057 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,204 KB
testcase_01 AC 76 ms
71,464 KB
testcase_02 AC 80 ms
71,632 KB
testcase_03 AC 75 ms
71,204 KB
testcase_04 AC 73 ms
71,336 KB
testcase_05 AC 144 ms
78,672 KB
testcase_06 AC 76 ms
71,620 KB
testcase_07 AC 75 ms
71,524 KB
testcase_08 AC 114 ms
78,560 KB
testcase_09 AC 77 ms
71,592 KB
testcase_10 AC 76 ms
71,448 KB
testcase_11 AC 74 ms
71,296 KB
testcase_12 AC 155 ms
78,964 KB
testcase_13 AC 75 ms
71,476 KB
testcase_14 AC 74 ms
71,472 KB
testcase_15 AC 75 ms
71,480 KB
testcase_16 AC 76 ms
71,168 KB
testcase_17 AC 115 ms
78,448 KB
testcase_18 AC 75 ms
71,424 KB
testcase_19 AC 75 ms
71,220 KB
testcase_20 AC 74 ms
71,368 KB
testcase_21 AC 75 ms
71,588 KB
testcase_22 AC 74 ms
71,676 KB
testcase_23 AC 75 ms
71,548 KB
testcase_24 AC 74 ms
71,420 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 206 ms
80,720 KB
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

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:continue
    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