結果

問題 No.1 道のショートカット
ユーザー Yuta123456Yuta123456
提出日時 2020-05-21 19:31:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 609 bytes
コンパイル時間 222 ms
コンパイル使用メモリ 10,808 KB
実行使用メモリ 12,904 KB
最終ジャッジ日時 2023-09-22 13:46:57
合計ジャッジ時間 7,100 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,748 KB
testcase_01 AC 16 ms
7,756 KB
testcase_02 AC 16 ms
7,900 KB
testcase_03 AC 16 ms
7,864 KB
testcase_04 AC 16 ms
7,696 KB
testcase_05 AC 15 ms
7,884 KB
testcase_06 AC 15 ms
7,764 KB
testcase_07 AC 16 ms
7,696 KB
testcase_08 AC 23 ms
8,308 KB
testcase_09 AC 17 ms
8,136 KB
testcase_10 AC 29 ms
8,216 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
c = int(input())
v = int(input())
s = list(map(int, input().split()))
t = list(map(int, input().split()))
y = list(map(int, input().split()))
m = list(map(int, input().split()))
adjacent_list = [[] for i in range(n+1)]
for i in range(v):
    adjacent_list[s[i]].append([t[i],y[i],m[i]])
ans = 10**9
def dfs(node,cost,time):
    if node == n:
        global ans
        ans = min(ans, time)
    for n_node, n_cost, n_time in adjacent_list[node]:
        if n_cost + cost <= c:
            dfs(n_node,n_cost + cost, time + n_time)
dfs(1,0,0)
if ans == 10**9:
    print(-1)
else:
    print(ans)
0