結果

問題 No.1 道のショートカット
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-04-05 09:55:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 606 bytes
コンパイル時間 1,013 ms
コンパイル使用メモリ 87,016 KB
実行使用メモリ 77,976 KB
最終ジャッジ日時 2023-08-28 21:55:16
合計ジャッジ時間 8,690 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,524 KB
testcase_01 AC 95 ms
71,368 KB
testcase_02 AC 95 ms
71,644 KB
testcase_03 AC 93 ms
71,636 KB
testcase_04 AC 93 ms
71,556 KB
testcase_05 AC 94 ms
71,608 KB
testcase_06 AC 94 ms
71,592 KB
testcase_07 AC 93 ms
71,204 KB
testcase_08 AC 143 ms
77,760 KB
testcase_09 AC 154 ms
77,772 KB
testcase_10 AC 126 ms
77,392 KB
testcase_11 AC 152 ms
77,532 KB
testcase_12 AC 209 ms
77,876 KB
testcase_13 AC 239 ms
77,976 KB
testcase_14 AC 110 ms
77,360 KB
testcase_15 AC 96 ms
71,552 KB
testcase_16 WA -
testcase_17 AC 96 ms
71,588 KB
testcase_18 AC 116 ms
77,416 KB
testcase_19 AC 118 ms
77,452 KB
testcase_20 AC 122 ms
77,572 KB
testcase_21 WA -
testcase_22 AC 112 ms
77,024 KB
testcase_23 AC 169 ms
77,796 KB
testcase_24 AC 177 ms
77,796 KB
testcase_25 AC 122 ms
77,720 KB
testcase_26 AC 115 ms
77,316 KB
testcase_27 AC 180 ms
77,740 KB
testcase_28 AC 113 ms
77,412 KB
testcase_29 AC 120 ms
77,952 KB
testcase_30 AC 109 ms
77,768 KB
testcase_31 AC 113 ms
77,780 KB
testcase_32 AC 138 ms
77,832 KB
testcase_33 AC 128 ms
77,592 KB
testcase_34 AC 169 ms
77,732 KB
testcase_35 AC 103 ms
77,200 KB
testcase_36 AC 114 ms
77,640 KB
testcase_37 WA -
testcase_38 AC 100 ms
76,988 KB
testcase_39 WA -
testcase_40 AC 110 ms
77,760 KB
testcase_41 AC 102 ms
76,636 KB
testcase_42 AC 95 ms
71,376 KB
testcase_43 AC 94 ms
71,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
n = int(input())
c = int(input())
v = int(input())
L = [list(map(int,input().split())) for i in range(4)]

e = [[] for i in range(n)]
for s,t,y,m in zip(L[0],L[1],L[2],L[3]):
    s -= 1
    t -= 1
    e[s].append((t,y,m))
    e[t].append((s,y,m))

inf = 10**10
dis = [[inf]*(c+1) for i in range(n)]
dis[0][c] = 0
q = deque([(0,c)])
while q:
    now,d = q.popleft()
    for nex,y,m in e[now]:
        if d >= y and dis[nex][d-y] > dis[now][d]+m:
            dis[nex][d-y] = dis[now][d]+m
            q.append((nex,d-y))
ans = min(dis[-1])
if ans == inf:
    ans = -1
print(ans)
0