結果

問題 No.2739 Time is money
ユーザー kaeru82433413kaeru82433413
提出日時 2024-04-21 19:55:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 469 bytes
コンパイル時間 463 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 132,156 KB
最終ジャッジ日時 2024-04-21 19:56:08
合計ジャッジ時間 14,525 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,352 KB
testcase_01 AC 40 ms
52,480 KB
testcase_02 WA -
testcase_03 AC 828 ms
113,812 KB
testcase_04 WA -
testcase_05 AC 609 ms
103,540 KB
testcase_06 AC 843 ms
114,856 KB
testcase_07 AC 904 ms
117,880 KB
testcase_08 AC 907 ms
119,808 KB
testcase_09 AC 968 ms
121,300 KB
testcase_10 WA -
testcase_11 AC 930 ms
120,836 KB
testcase_12 AC 523 ms
110,976 KB
testcase_13 AC 519 ms
110,848 KB
testcase_14 AC 412 ms
109,568 KB
testcase_15 AC 555 ms
130,108 KB
testcase_16 AC 506 ms
111,232 KB
testcase_17 AC 915 ms
121,816 KB
testcase_18 AC 996 ms
121,808 KB
testcase_19 AC 761 ms
132,156 KB
権限があれば一括ダウンロードができます

ソースコード

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