結果

問題 No.1 道のショートカット
ユーザー TawaraTawara
提出日時 2016-08-02 22:55:04
言語 Python2
(2.7.18)
結果
AC  
実行時間 52 ms / 5,000 ms
コード長 469 bytes
コンパイル時間 62 ms
コンパイル使用メモリ 6,520 KB
実行使用メモリ 6,652 KB
最終ジャッジ日時 2023-09-27 21:57:45
合計ジャッジ時間 2,259 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
6,048 KB
testcase_01 AC 10 ms
6,048 KB
testcase_02 AC 9 ms
6,104 KB
testcase_03 AC 10 ms
5,996 KB
testcase_04 AC 9 ms
5,988 KB
testcase_05 AC 9 ms
6,096 KB
testcase_06 AC 9 ms
6,204 KB
testcase_07 AC 9 ms
5,976 KB
testcase_08 AC 19 ms
6,204 KB
testcase_09 AC 14 ms
6,320 KB
testcase_10 AC 16 ms
6,244 KB
testcase_11 AC 25 ms
6,332 KB
testcase_12 AC 43 ms
6,652 KB
testcase_13 AC 40 ms
6,640 KB
testcase_14 AC 10 ms
6,040 KB
testcase_15 AC 10 ms
6,160 KB
testcase_16 AC 11 ms
6,104 KB
testcase_17 AC 10 ms
6,012 KB
testcase_18 AC 10 ms
6,124 KB
testcase_19 AC 12 ms
6,148 KB
testcase_20 AC 13 ms
6,232 KB
testcase_21 AC 12 ms
6,208 KB
testcase_22 AC 11 ms
6,168 KB
testcase_23 AC 52 ms
6,220 KB
testcase_24 AC 47 ms
6,156 KB
testcase_25 AC 16 ms
6,160 KB
testcase_26 AC 13 ms
6,164 KB
testcase_27 AC 41 ms
6,240 KB
testcase_28 AC 10 ms
6,060 KB
testcase_29 AC 18 ms
6,356 KB
testcase_30 AC 11 ms
6,064 KB
testcase_31 AC 15 ms
6,172 KB
testcase_32 AC 21 ms
6,260 KB
testcase_33 AC 16 ms
6,208 KB
testcase_34 AC 44 ms
6,300 KB
testcase_35 AC 12 ms
6,112 KB
testcase_36 AC 14 ms
6,120 KB
testcase_37 AC 12 ms
6,100 KB
testcase_38 AC 9 ms
6,148 KB
testcase_39 AC 10 ms
6,096 KB
testcase_40 AC 10 ms
6,200 KB
testcase_41 AC 10 ms
6,180 KB
testcase_42 AC 9 ms
5,984 KB
testcase_43 AC 10 ms
6,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

M = 10**6
I = lambda:map(int,raw_input().split())
i = lambda:input()
N,C,V = i(),i(),i() 
L = [[] for i in xrange(N)]
for s,t,y,m in zip(I(),I(),I(),I()):
	L[s-1].append((t-1,y,m))
dp = [[M]*(C+1) for _ in xrange(N)]
dp[0][0] = 0
for s in xrange(N-1):
	for c in xrange(C):
		if dp[s][c] == M:
			continue
		tmp = dp[s][c]
		for t,y,m in L[s]:
			if c+y > C: continue
			if tmp + m < dp[t][c+y]:
				dp[t][c+y] = tmp + m
ans = min(dp[N-1])
print - 1 if ans == M else ans
0