結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,956 KB
testcase_01 AC 16 ms
7,808 KB
testcase_02 AC 16 ms
7,828 KB
testcase_03 AC 15 ms
7,832 KB
testcase_04 AC 16 ms
7,820 KB
testcase_05 AC 16 ms
7,816 KB
testcase_06 AC 17 ms
7,852 KB
testcase_07 AC 16 ms
7,804 KB
testcase_08 AC 377 ms
8,424 KB
testcase_09 AC 73 ms
8,276 KB
testcase_10 AC 213 ms
8,220 KB
testcase_11 AC 352 ms
8,280 KB
testcase_12 AC 1,295 ms
8,532 KB
testcase_13 AC 1,194 ms
8,604 KB
testcase_14 AC 18 ms
8,328 KB
testcase_15 AC 18 ms
8,156 KB
testcase_16 AC 25 ms
8,292 KB
testcase_17 AC 17 ms
8,260 KB
testcase_18 AC 19 ms
7,960 KB
testcase_19 AC 20 ms
8,364 KB
testcase_20 AC 73 ms
8,404 KB
testcase_21 AC 27 ms
8,220 KB
testcase_22 AC 19 ms
7,968 KB
testcase_23 AC 504 ms
8,256 KB
testcase_24 AC 491 ms
8,384 KB
testcase_25 AC 92 ms
8,344 KB
testcase_26 AC 47 ms
8,252 KB
testcase_27 AC 688 ms
8,280 KB
testcase_28 AC 17 ms
7,744 KB
testcase_29 AC 131 ms
8,288 KB
testcase_30 AC 24 ms
7,904 KB
testcase_31 AC 48 ms
8,268 KB
testcase_32 AC 267 ms
8,304 KB
testcase_33 AC 123 ms
8,436 KB
testcase_34 AC 480 ms
8,280 KB
testcase_35 AC 18 ms
8,348 KB
testcase_36 AC 73 ms
8,248 KB
testcase_37 AC 26 ms
8,332 KB
testcase_38 AC 17 ms
7,916 KB
testcase_39 AC 19 ms
8,416 KB
testcase_40 AC 23 ms
8,228 KB
testcase_41 AC 17 ms
7,788 KB
testcase_42 AC 16 ms
7,920 KB
testcase_43 AC 18 ms
8,292 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] * (C + 1) for i in range(N)]
dp[0][0] = 0
for i in range(N):
	for j in range(C):
		if dp[i][j] != INF:
			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