結果

問題 No.1 道のショートカット
ユーザー koukou
提出日時 2019-12-16 21:48:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 490 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 10,844 KB
実行使用メモリ 16,464 KB
最終ジャッジ日時 2023-09-22 13:39:50
合計ジャッジ時間 23,723 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
16,464 KB
testcase_01 AC 17 ms
7,964 KB
testcase_02 AC 16 ms
7,788 KB
testcase_03 AC 16 ms
7,820 KB
testcase_04 AC 16 ms
7,820 KB
testcase_05 AC 16 ms
7,916 KB
testcase_06 AC 16 ms
7,736 KB
testcase_07 AC 16 ms
7,956 KB
testcase_08 AC 1,464 ms
8,548 KB
testcase_09 AC 119 ms
8,484 KB
testcase_10 AC 288 ms
8,604 KB
testcase_11 AC 1,488 ms
8,564 KB
testcase_12 AC 4,274 ms
8,344 KB
testcase_13 AC 4,800 ms
8,436 KB
testcase_14 AC 27 ms
7,808 KB
testcase_15 AC 16 ms
8,224 KB
testcase_16 AC 40 ms
8,328 KB
testcase_17 AC 16 ms
7,860 KB
testcase_18 AC 22 ms
7,900 KB
testcase_19 AC 25 ms
8,192 KB
testcase_20 AC 178 ms
8,292 KB
testcase_21 AC 59 ms
8,288 KB
testcase_22 AC 29 ms
8,160 KB
testcase_23 AC 3,231 ms
8,508 KB
testcase_24 TLE -
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, 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
q = [0]
while q:
	cur = q.pop()
	for nxt, y, m in g[cur]:
		update=0
		for i in range(y, c + 1):
			if dp[nxt][i - y] > dp[cur][i] + m:
				dp[nxt][i - y] = dp[cur][i] + m
				update=1
		if update:
			q.append(nxt)
ans = min(dp[-1])
print(ans if ans != 1 << 30 else -1)
0