結果
問題 | No.1 道のショートカット |
ユーザー | tookunn_1213 |
提出日時 | 2016-08-23 11:07:24 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 1,440 ms / 5,000 ms |
コード長 | 538 bytes |
コンパイル時間 | 224 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-07-20 16:25:09 |
合計ジャッジ時間 | 10,247 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 31 ms
10,752 KB |
testcase_01 | AC | 31 ms
10,624 KB |
testcase_02 | AC | 31 ms
10,624 KB |
testcase_03 | AC | 31 ms
10,624 KB |
testcase_04 | AC | 31 ms
10,624 KB |
testcase_05 | AC | 31 ms
10,752 KB |
testcase_06 | AC | 30 ms
10,752 KB |
testcase_07 | AC | 30 ms
10,752 KB |
testcase_08 | AC | 437 ms
10,752 KB |
testcase_09 | AC | 92 ms
10,880 KB |
testcase_10 | AC | 246 ms
10,752 KB |
testcase_11 | AC | 443 ms
10,752 KB |
testcase_12 | AC | 1,440 ms
11,008 KB |
testcase_13 | AC | 1,341 ms
11,008 KB |
testcase_14 | AC | 34 ms
10,752 KB |
testcase_15 | AC | 32 ms
10,624 KB |
testcase_16 | AC | 40 ms
10,752 KB |
testcase_17 | AC | 32 ms
10,624 KB |
testcase_18 | AC | 34 ms
10,752 KB |
testcase_19 | AC | 35 ms
10,880 KB |
testcase_20 | AC | 85 ms
10,496 KB |
testcase_21 | AC | 43 ms
10,880 KB |
testcase_22 | AC | 35 ms
10,752 KB |
testcase_23 | AC | 548 ms
10,752 KB |
testcase_24 | AC | 591 ms
10,880 KB |
testcase_25 | AC | 113 ms
10,752 KB |
testcase_26 | AC | 66 ms
10,752 KB |
testcase_27 | AC | 868 ms
10,752 KB |
testcase_28 | AC | 31 ms
10,624 KB |
testcase_29 | AC | 160 ms
10,752 KB |
testcase_30 | AC | 40 ms
10,624 KB |
testcase_31 | AC | 64 ms
10,624 KB |
testcase_32 | AC | 302 ms
10,880 KB |
testcase_33 | AC | 141 ms
10,752 KB |
testcase_34 | AC | 567 ms
10,752 KB |
testcase_35 | AC | 33 ms
10,752 KB |
testcase_36 | AC | 94 ms
10,752 KB |
testcase_37 | AC | 42 ms
10,752 KB |
testcase_38 | AC | 31 ms
10,752 KB |
testcase_39 | AC | 35 ms
10,880 KB |
testcase_40 | AC | 39 ms
10,880 KB |
testcase_41 | AC | 32 ms
10,752 KB |
testcase_42 | AC | 31 ms
10,752 KB |
testcase_43 | AC | 33 ms
10,880 KB |
ソースコード
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): 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)