結果

問題 No.1 道のショートカット
ユーザー matsu7874matsu7874
提出日時 2015-12-07 21:36:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 293 ms / 5,000 ms
コード長 531 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 10,880 KB
実行使用メモリ 8,984 KB
最終ジャッジ日時 2023-09-27 21:49:42
合計ジャッジ時間 4,507 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,440 KB
testcase_01 AC 18 ms
8,440 KB
testcase_02 AC 16 ms
8,592 KB
testcase_03 AC 17 ms
8,604 KB
testcase_04 AC 17 ms
8,588 KB
testcase_05 AC 17 ms
8,540 KB
testcase_06 AC 17 ms
8,504 KB
testcase_07 AC 17 ms
8,424 KB
testcase_08 AC 220 ms
8,632 KB
testcase_09 AC 117 ms
8,552 KB
testcase_10 AC 68 ms
8,672 KB
testcase_11 AC 80 ms
8,672 KB
testcase_12 AC 273 ms
8,984 KB
testcase_13 AC 293 ms
8,956 KB
testcase_14 AC 31 ms
8,496 KB
testcase_15 AC 17 ms
8,492 KB
testcase_16 AC 49 ms
8,616 KB
testcase_17 AC 17 ms
8,440 KB
testcase_18 AC 24 ms
8,508 KB
testcase_19 AC 32 ms
8,604 KB
testcase_20 AC 37 ms
8,472 KB
testcase_21 AC 41 ms
8,456 KB
testcase_22 AC 28 ms
8,496 KB
testcase_23 AC 138 ms
8,696 KB
testcase_24 AC 144 ms
8,688 KB
testcase_25 AC 58 ms
8,432 KB
testcase_26 AC 44 ms
8,588 KB
testcase_27 AC 117 ms
8,660 KB
testcase_28 AC 17 ms
8,596 KB
testcase_29 AC 46 ms
8,704 KB
testcase_30 AC 22 ms
8,660 KB
testcase_31 AC 40 ms
8,656 KB
testcase_32 AC 146 ms
8,748 KB
testcase_33 AC 103 ms
8,588 KB
testcase_34 AC 204 ms
8,884 KB
testcase_35 AC 21 ms
8,596 KB
testcase_36 AC 42 ms
8,668 KB
testcase_37 AC 20 ms
8,688 KB
testcase_38 AC 21 ms
8,516 KB
testcase_39 AC 43 ms
8,616 KB
testcase_40 AC 22 ms
8,620 KB
testcase_41 AC 17 ms
8,504 KB
testcase_42 AC 15 ms
8,476 KB
testcase_43 AC 15 ms
8,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
C = int(input())
V = int(input())
S = [int(x) for x in input().split()]
T = [int(x) for x in input().split()]
Y = [int(x) for x in input().split()]
M = [int(x) for x in input().split()]

Vec = [(S[i], T[i], Y[i], M[i]) for i in range(V)]
Vec.sort()

dp = [[50001 for j in range(601)] for i in range(51)]
dp[1][C] = 0
for v in Vec:
    for i in range(C + 1):
        dp[v[1]][i] = min(dp[v[1]][i], dp[v[0]][i + v[2]] + v[3])
min_minute = min(dp[N])
if min_minute == 50001:
    print(-1)
else:
    print(min_minute)
0