結果

問題 No.1 道のショートカット
ユーザー TawaraTawara
提出日時 2016-07-26 01:04:20
言語 Python2
(2.7.18)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 469 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 6,672 KB
実行使用メモリ 6,728 KB
最終ジャッジ日時 2023-09-22 12:45:52
合計ジャッジ時間 2,718 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,080 KB
testcase_01 AC 11 ms
6,192 KB
testcase_02 AC 11 ms
5,980 KB
testcase_03 AC 12 ms
6,080 KB
testcase_04 AC 11 ms
6,048 KB
testcase_05 AC 11 ms
6,116 KB
testcase_06 AC 11 ms
6,232 KB
testcase_07 AC 12 ms
6,112 KB
testcase_08 AC 23 ms
6,316 KB
testcase_09 AC 16 ms
6,304 KB
testcase_10 AC 20 ms
6,256 KB
testcase_11 AC 31 ms
6,352 KB
testcase_12 AC 50 ms
6,728 KB
testcase_13 AC 48 ms
6,700 KB
testcase_14 AC 12 ms
6,048 KB
testcase_15 RE -
testcase_16 AC 13 ms
6,204 KB
testcase_17 RE -
testcase_18 AC 13 ms
6,044 KB
testcase_19 AC 12 ms
6,156 KB
testcase_20 AC 16 ms
6,104 KB
testcase_21 AC 14 ms
6,100 KB
testcase_22 AC 13 ms
6,264 KB
testcase_23 AC 56 ms
6,568 KB
testcase_24 AC 54 ms
6,312 KB
testcase_25 AC 19 ms
6,252 KB
testcase_26 AC 16 ms
6,292 KB
testcase_27 AC 47 ms
6,284 KB
testcase_28 AC 11 ms
6,088 KB
testcase_29 AC 22 ms
6,452 KB
testcase_30 AC 13 ms
6,308 KB
testcase_31 AC 18 ms
6,276 KB
testcase_32 AC 25 ms
6,404 KB
testcase_33 AC 18 ms
6,196 KB
testcase_34 AC 52 ms
6,292 KB
testcase_35 AC 14 ms
6,120 KB
testcase_36 AC 17 ms
6,356 KB
testcase_37 AC 15 ms
6,120 KB
testcase_38 AC 12 ms
6,092 KB
testcase_39 AC 13 ms
6,348 KB
testcase_40 AC 13 ms
6,116 KB
testcase_41 AC 12 ms
6,028 KB
testcase_42 RE -
testcase_43 RE -
権限があれば一括ダウンロードができます

ソースコード

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(V)]
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