結果

問題 No.1 道のショートカット
ユーザー kyunakyuna
提出日時 2018-06-15 04:37:39
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 2,382 ms / 5,000 ms
コード長 541 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 10,976 KB
実行使用メモリ 8,684 KB
最終ジャッジ日時 2023-09-27 22:15:57
合計ジャッジ時間 17,237 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,812 KB
testcase_01 AC 15 ms
7,844 KB
testcase_02 AC 15 ms
7,852 KB
testcase_03 AC 14 ms
7,936 KB
testcase_04 AC 13 ms
7,812 KB
testcase_05 AC 14 ms
7,844 KB
testcase_06 AC 14 ms
7,848 KB
testcase_07 AC 14 ms
7,736 KB
testcase_08 AC 1,873 ms
8,424 KB
testcase_09 AC 923 ms
8,388 KB
testcase_10 AC 496 ms
8,400 KB
testcase_11 AC 630 ms
8,236 KB
testcase_12 AC 2,368 ms
8,664 KB
testcase_13 AC 2,382 ms
8,684 KB
testcase_14 AC 67 ms
7,944 KB
testcase_15 AC 16 ms
8,344 KB
testcase_16 AC 277 ms
8,352 KB
testcase_17 AC 19 ms
7,808 KB
testcase_18 AC 81 ms
7,844 KB
testcase_19 AC 124 ms
8,380 KB
testcase_20 AC 195 ms
8,244 KB
testcase_21 AC 178 ms
8,348 KB
testcase_22 AC 85 ms
7,792 KB
testcase_23 AC 595 ms
8,172 KB
testcase_24 AC 674 ms
8,300 KB
testcase_25 AC 250 ms
8,284 KB
testcase_26 AC 140 ms
8,144 KB
testcase_27 AC 960 ms
8,348 KB
testcase_28 AC 20 ms
7,944 KB
testcase_29 AC 164 ms
8,340 KB
testcase_30 AC 30 ms
7,804 KB
testcase_31 AC 53 ms
8,244 KB
testcase_32 AC 1,036 ms
8,272 KB
testcase_33 AC 638 ms
8,280 KB
testcase_34 AC 725 ms
8,236 KB
testcase_35 AC 17 ms
8,216 KB
testcase_36 AC 217 ms
8,212 KB
testcase_37 AC 28 ms
8,416 KB
testcase_38 AC 39 ms
7,796 KB
testcase_39 AC 202 ms
8,340 KB
testcase_40 AC 63 ms
8,208 KB
testcase_41 AC 23 ms
7,796 KB
testcase_42 AC 14 ms
7,808 KB
testcase_43 AC 17 ms
8,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, C, V = [int(input()) for _ in range(3)]
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()))
e = [[] for _ in [0] * N]
INF = float('inf')
dp = [[INF] * (C + 1) for _ in [0] * 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(dp[N - 1])
print(-1 if ans == INF else ans)
0