結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,824 KB
testcase_01 AC 17 ms
7,864 KB
testcase_02 AC 17 ms
7,808 KB
testcase_03 AC 17 ms
7,920 KB
testcase_04 AC 18 ms
7,840 KB
testcase_05 AC 17 ms
7,848 KB
testcase_06 AC 16 ms
7,848 KB
testcase_07 AC 17 ms
7,828 KB
testcase_08 AC 2,078 ms
8,424 KB
testcase_09 AC 1,047 ms
8,272 KB
testcase_10 AC 568 ms
8,196 KB
testcase_11 AC 661 ms
8,304 KB
testcase_12 AC 2,917 ms
8,720 KB
testcase_13 AC 2,876 ms
8,752 KB
testcase_14 AC 78 ms
7,920 KB
testcase_15 AC 20 ms
8,348 KB
testcase_16 AC 325 ms
8,312 KB
testcase_17 AC 22 ms
8,348 KB
testcase_18 AC 90 ms
8,352 KB
testcase_19 AC 141 ms
8,284 KB
testcase_20 AC 207 ms
8,212 KB
testcase_21 AC 197 ms
8,308 KB
testcase_22 AC 99 ms
7,784 KB
testcase_23 AC 635 ms
8,244 KB
testcase_24 AC 755 ms
8,312 KB
testcase_25 AC 273 ms
8,312 KB
testcase_26 AC 154 ms
8,288 KB
testcase_27 AC 1,098 ms
8,276 KB
testcase_28 AC 24 ms
7,788 KB
testcase_29 AC 185 ms
8,304 KB
testcase_30 AC 35 ms
7,844 KB
testcase_31 AC 61 ms
8,360 KB
testcase_32 AC 1,204 ms
8,324 KB
testcase_33 AC 710 ms
8,304 KB
testcase_34 AC 793 ms
8,224 KB
testcase_35 AC 20 ms
8,352 KB
testcase_36 AC 240 ms
8,312 KB
testcase_37 AC 32 ms
8,300 KB
testcase_38 AC 46 ms
7,876 KB
testcase_39 AC 223 ms
8,356 KB
testcase_40 AC 68 ms
8,324 KB
testcase_41 AC 29 ms
7,816 KB
testcase_42 AC 17 ms
7,908 KB
testcase_43 AC 21 ms
8,420 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 = INF
for i in range(C + 1):
	ans = min(ans,dp[N - 1][i])
print(-1 if ans == INF else ans)
0