結果

問題 No.1 道のショートカット
ユーザー dangodango
提出日時 2023-06-14 21:39:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 88 ms / 5,000 ms
コード長 409 bytes
コンパイル時間 1,168 ms
コンパイル使用メモリ 86,840 KB
実行使用メモリ 76,824 KB
最終ジャッジ日時 2023-09-05 07:15:03
合計ジャッジ時間 7,077 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,184 KB
testcase_01 AC 72 ms
71,380 KB
testcase_02 AC 70 ms
71,508 KB
testcase_03 AC 69 ms
71,184 KB
testcase_04 AC 70 ms
71,112 KB
testcase_05 AC 70 ms
71,388 KB
testcase_06 AC 70 ms
71,384 KB
testcase_07 AC 72 ms
71,116 KB
testcase_08 AC 87 ms
76,652 KB
testcase_09 AC 82 ms
76,508 KB
testcase_10 AC 85 ms
76,248 KB
testcase_11 AC 86 ms
76,676 KB
testcase_12 AC 88 ms
76,716 KB
testcase_13 AC 87 ms
76,824 KB
testcase_14 AC 79 ms
75,792 KB
testcase_15 AC 72 ms
71,388 KB
testcase_16 AC 79 ms
76,636 KB
testcase_17 AC 71 ms
71,344 KB
testcase_18 AC 74 ms
75,832 KB
testcase_19 AC 77 ms
76,116 KB
testcase_20 AC 79 ms
76,520 KB
testcase_21 AC 77 ms
75,956 KB
testcase_22 AC 77 ms
75,840 KB
testcase_23 AC 87 ms
76,736 KB
testcase_24 AC 86 ms
76,348 KB
testcase_25 AC 80 ms
76,800 KB
testcase_26 AC 79 ms
75,736 KB
testcase_27 AC 85 ms
76,792 KB
testcase_28 AC 76 ms
75,724 KB
testcase_29 AC 82 ms
76,672 KB
testcase_30 AC 78 ms
76,500 KB
testcase_31 AC 81 ms
76,356 KB
testcase_32 AC 84 ms
76,636 KB
testcase_33 AC 83 ms
76,240 KB
testcase_34 AC 85 ms
76,772 KB
testcase_35 AC 76 ms
76,440 KB
testcase_36 AC 79 ms
76,332 KB
testcase_37 AC 81 ms
76,552 KB
testcase_38 AC 76 ms
75,812 KB
testcase_39 AC 77 ms
75,924 KB
testcase_40 AC 78 ms
76,660 KB
testcase_41 AC 77 ms
75,652 KB
testcase_42 AC 70 ms
71,124 KB
testcase_43 AC 71 ms
71,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, c, v, *L = map(int, open(0).read().split())
g = [[] for _ in range(n)]
for s, t, y, m in zip(L, L[v:], L[2 * v:], L[3 * v:]):
	g[s - 1].append((t - 1, y, m))
dp = [[1 << 30] * (c + 1) for _ in range(n)]
dp[0][c] = 0
for f in range(n):
	for t, y, m in g[f]:
		for i in range(y, c + 1):
			if dp[f][i] + m < dp[t][i - y]:
				dp[t][i - y] = dp[f][i] + m
ans = min(dp[-1])
print(ans if ans != 1 << 30 else -1)
0