結果

問題 No.1 道のショートカット
ユーザー hanorverhanorver
提出日時 2016-08-23 11:32:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,287 ms / 5,000 ms
コード長 521 bytes
コンパイル時間 1,047 ms
コンパイル使用メモリ 10,804 KB
実行使用メモリ 8,568 KB
最終ジャッジ日時 2023-09-27 21:59:23
合計ジャッジ時間 7,819 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
7,772 KB
testcase_01 AC 14 ms
7,912 KB
testcase_02 AC 13 ms
7,916 KB
testcase_03 AC 14 ms
7,824 KB
testcase_04 AC 13 ms
7,780 KB
testcase_05 AC 14 ms
7,692 KB
testcase_06 AC 13 ms
7,728 KB
testcase_07 AC 13 ms
7,736 KB
testcase_08 AC 317 ms
8,348 KB
testcase_09 AC 61 ms
8,236 KB
testcase_10 AC 204 ms
8,272 KB
testcase_11 AC 316 ms
8,196 KB
testcase_12 AC 1,287 ms
8,520 KB
testcase_13 AC 1,059 ms
8,568 KB
testcase_14 AC 16 ms
8,176 KB
testcase_15 AC 14 ms
8,188 KB
testcase_16 AC 21 ms
8,280 KB
testcase_17 AC 14 ms
7,828 KB
testcase_18 AC 15 ms
7,904 KB
testcase_19 AC 16 ms
8,356 KB
testcase_20 AC 59 ms
8,244 KB
testcase_21 AC 23 ms
8,112 KB
testcase_22 AC 17 ms
8,192 KB
testcase_23 AC 438 ms
8,248 KB
testcase_24 AC 422 ms
8,240 KB
testcase_25 AC 85 ms
8,160 KB
testcase_26 AC 42 ms
8,304 KB
testcase_27 AC 606 ms
8,260 KB
testcase_28 AC 14 ms
7,832 KB
testcase_29 AC 119 ms
8,176 KB
testcase_30 AC 20 ms
7,796 KB
testcase_31 AC 41 ms
8,180 KB
testcase_32 AC 240 ms
8,324 KB
testcase_33 AC 104 ms
8,420 KB
testcase_34 AC 444 ms
8,180 KB
testcase_35 AC 15 ms
8,180 KB
testcase_36 AC 64 ms
8,200 KB
testcase_37 AC 22 ms
8,256 KB
testcase_38 AC 14 ms
7,768 KB
testcase_39 AC 16 ms
8,280 KB
testcase_40 AC 18 ms
8,144 KB
testcase_41 AC 14 ms
7,920 KB
testcase_42 AC 13 ms
7,772 KB
testcase_43 AC 14 ms
8,248 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 = list(map(int, input().split()))
M =list(map(int, 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