結果

問題 No.1 道のショートカット
ユーザー tookunn_1213tookunn_1213
提出日時 2016-08-23 11:05:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,498 ms / 5,000 ms
コード長 513 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 10,980 KB
実行使用メモリ 8,628 KB
最終ジャッジ日時 2023-09-27 21:59:59
合計ジャッジ時間 18,659 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,872 KB
testcase_01 AC 14 ms
7,884 KB
testcase_02 AC 14 ms
7,684 KB
testcase_03 AC 13 ms
7,788 KB
testcase_04 AC 13 ms
7,852 KB
testcase_05 AC 14 ms
7,748 KB
testcase_06 AC 13 ms
7,812 KB
testcase_07 AC 14 ms
7,816 KB
testcase_08 AC 1,954 ms
8,444 KB
testcase_09 AC 1,018 ms
8,304 KB
testcase_10 AC 523 ms
8,348 KB
testcase_11 AC 615 ms
8,148 KB
testcase_12 AC 2,498 ms
8,628 KB
testcase_13 AC 2,489 ms
8,536 KB
testcase_14 AC 79 ms
7,680 KB
testcase_15 AC 17 ms
8,144 KB
testcase_16 AC 299 ms
8,216 KB
testcase_17 AC 19 ms
7,788 KB
testcase_18 AC 87 ms
7,924 KB
testcase_19 AC 122 ms
8,216 KB
testcase_20 AC 195 ms
8,296 KB
testcase_21 AC 183 ms
8,188 KB
testcase_22 AC 93 ms
7,708 KB
testcase_23 AC 608 ms
8,220 KB
testcase_24 AC 734 ms
8,244 KB
testcase_25 AC 242 ms
8,156 KB
testcase_26 AC 133 ms
8,208 KB
testcase_27 AC 969 ms
8,204 KB
testcase_28 AC 20 ms
7,800 KB
testcase_29 AC 172 ms
8,276 KB
testcase_30 AC 35 ms
7,712 KB
testcase_31 AC 57 ms
8,228 KB
testcase_32 AC 1,131 ms
8,244 KB
testcase_33 AC 661 ms
8,304 KB
testcase_34 AC 734 ms
8,348 KB
testcase_35 AC 17 ms
8,316 KB
testcase_36 AC 219 ms
8,228 KB
testcase_37 AC 28 ms
8,236 KB
testcase_38 AC 41 ms
7,864 KB
testcase_39 AC 202 ms
8,304 KB
testcase_40 AC 64 ms
8,300 KB
testcase_41 AC 24 ms
7,764 KB
testcase_42 AC 14 ms
7,844 KB
testcase_43 AC 18 ms
8,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,C,V = int(input()),int(input()),int(input())
S = [int(i) - 1 for i in input().split()]
T = [int(i) - 1 for i in input().split()]
Y = [int(i) for i in input().split()]
M = [int(i) for i in input().split()]
INF = 10 ** 9 + 7
dp = [[INF for j in range(C + 1)] for i in range(N)]
dp[0][0] = 0
for i in range(N):
	for j in range(C):
		for k in range(V):
			if S[k] == i and j + Y[k] <= C:
				dp[T[k]][j + Y[k]] = min(dp[T[k]][j + Y[k]],dp[i][j] + M[k])
ans = min(INF,min(dp[N - 1]))
print(-1 if ans == INF else ans)
0