結果

問題 No.2739 Time is money
ユーザー kaeru82433413
提出日時 2024-04-21 19:55:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 469 bytes
コンパイル時間 185 ms
コンパイル使用メモリ 82,040 KB
実行使用メモリ 132,276 KB
最終ジャッジ日時 2024-10-13 18:38:07
合計ジャッジ時間 14,162 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop as pop, heappush as push

N, M, X = map(int, input().split())
edges = [[] for _ in range(N)]
for _ in range(M):
    u, v, C, T = map(int, input().split())
    u -= 1
    v -= 1
    edges[u].append((v, C+T*X))
    edges[v].append((u, C+T*X))

queue = [(0, 0)]
ans = [-1]*N

while queue:
    c, v = pop(queue)
    if ans[v] != -1:
        continue
    ans[v] = c

    for u, c_ in edges[v]:
        push(queue, (c+c_, u))
print((ans[-1]-1)//X+1)
0