結果

問題 No.1 道のショートカット
ユーザー square1001square1001
提出日時 2022-02-17 10:31:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 231 ms / 5,000 ms
コード長 531 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 10,780 KB
実行使用メモリ 8,560 KB
最終ジャッジ日時 2023-09-11 17:29:02
合計ジャッジ時間 5,045 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,780 KB
testcase_01 AC 17 ms
7,768 KB
testcase_02 AC 17 ms
7,924 KB
testcase_03 AC 16 ms
7,832 KB
testcase_04 AC 16 ms
7,880 KB
testcase_05 AC 16 ms
7,856 KB
testcase_06 AC 16 ms
7,820 KB
testcase_07 AC 16 ms
7,908 KB
testcase_08 AC 172 ms
8,276 KB
testcase_09 AC 95 ms
8,344 KB
testcase_10 AC 60 ms
8,268 KB
testcase_11 AC 87 ms
8,364 KB
testcase_12 AC 231 ms
8,488 KB
testcase_13 AC 219 ms
8,560 KB
testcase_14 AC 28 ms
8,212 KB
testcase_15 AC 17 ms
8,360 KB
testcase_16 AC 45 ms
8,268 KB
testcase_17 AC 17 ms
7,760 KB
testcase_18 AC 26 ms
7,820 KB
testcase_19 AC 36 ms
8,312 KB
testcase_20 AC 43 ms
8,248 KB
testcase_21 AC 49 ms
8,216 KB
testcase_22 AC 33 ms
7,932 KB
testcase_23 AC 166 ms
8,280 KB
testcase_24 AC 190 ms
8,364 KB
testcase_25 AC 69 ms
8,280 KB
testcase_26 AC 54 ms
7,824 KB
testcase_27 AC 146 ms
8,280 KB
testcase_28 AC 18 ms
7,756 KB
testcase_29 AC 40 ms
8,272 KB
testcase_30 AC 21 ms
7,828 KB
testcase_31 AC 36 ms
8,320 KB
testcase_32 AC 122 ms
8,220 KB
testcase_33 AC 88 ms
8,416 KB
testcase_34 AC 155 ms
8,220 KB
testcase_35 AC 20 ms
8,212 KB
testcase_36 AC 39 ms
8,208 KB
testcase_37 AC 20 ms
8,224 KB
testcase_38 AC 20 ms
7,772 KB
testcase_39 AC 39 ms
8,340 KB
testcase_40 AC 22 ms
8,200 KB
testcase_41 AC 18 ms
7,812 KB
testcase_42 AC 17 ms
7,928 KB
testcase_43 AC 17 ms
8,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
C = int(input())
V = int(input())
S = [ int(x) - 1 for x in input().split() ]
T = [ int(x) - 1 for x in input().split() ]
Y = list(map(int, input().split()))
M = list(map(int, input().split()))

dp = [ [ 10 ** 18 ] * N for i in range(C + 1) ]
dp[0][0] = 0
for i in range(1, C + 1):
	for j in range(V):
		if i >= Y[j]:
			dp[i][T[j]] = min(dp[i][T[j]], dp[i - Y[j]][S[j]] + M[j])

answer = 10 ** 18
for i in range(1, C + 1):
	answer = min(answer, dp[i][N - 1])

if answer < 10 ** 18:
	print(answer)
else:
	print(-1)
0