結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,864 KB
testcase_01 AC 39 ms
52,480 KB
testcase_02 WA -
testcase_03 AC 916 ms
114,200 KB
testcase_04 WA -
testcase_05 AC 718 ms
104,172 KB
testcase_06 AC 942 ms
114,792 KB
testcase_07 AC 974 ms
118,256 KB
testcase_08 AC 1,020 ms
120,320 KB
testcase_09 AC 1,032 ms
121,424 KB
testcase_10 WA -
testcase_11 AC 1,068 ms
121,216 KB
testcase_12 AC 561 ms
110,752 KB
testcase_13 AC 579 ms
110,676 KB
testcase_14 AC 468 ms
109,824 KB
testcase_15 AC 603 ms
130,156 KB
testcase_16 AC 550 ms
111,232 KB
testcase_17 AC 1,005 ms
122,472 KB
testcase_18 AC 1,072 ms
121,940 KB
testcase_19 AC 850 ms
132,280 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