結果

問題 No.1 道のショートカット
ユーザー tomiyancetomiyance
提出日時 2019-11-26 20:39:20
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 577 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 10,844 KB
実行使用メモリ 8,712 KB
最終ジャッジ日時 2023-09-22 13:38:42
合計ジャッジ時間 8,705 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 17 ms
7,784 KB
testcase_03 AC 16 ms
7,796 KB
testcase_04 WA -
testcase_05 AC 16 ms
7,796 KB
testcase_06 AC 16 ms
7,840 KB
testcase_07 AC 16 ms
7,832 KB
testcase_08 AC 365 ms
8,416 KB
testcase_09 AC 73 ms
8,348 KB
testcase_10 AC 214 ms
8,232 KB
testcase_11 AC 387 ms
8,300 KB
testcase_12 AC 1,337 ms
8,712 KB
testcase_13 AC 1,196 ms
8,668 KB
testcase_14 AC 18 ms
8,284 KB
testcase_15 AC 17 ms
8,228 KB
testcase_16 AC 24 ms
8,296 KB
testcase_17 AC 17 ms
8,320 KB
testcase_18 AC 18 ms
7,804 KB
testcase_19 AC 19 ms
8,256 KB
testcase_20 AC 65 ms
8,192 KB
testcase_21 AC 27 ms
8,176 KB
testcase_22 AC 19 ms
7,840 KB
testcase_23 AC 497 ms
8,360 KB
testcase_24 AC 478 ms
8,312 KB
testcase_25 AC 91 ms
8,284 KB
testcase_26 AC 47 ms
8,204 KB
testcase_27 AC 712 ms
8,328 KB
testcase_28 AC 16 ms
7,952 KB
testcase_29 AC 129 ms
8,268 KB
testcase_30 AC 24 ms
7,828 KB
testcase_31 AC 48 ms
8,228 KB
testcase_32 AC 288 ms
8,264 KB
testcase_33 AC 118 ms
8,288 KB
testcase_34 AC 490 ms
8,284 KB
testcase_35 AC 18 ms
8,376 KB
testcase_36 AC 77 ms
8,292 KB
testcase_37 AC 28 ms
8,204 KB
testcase_38 AC 16 ms
7,920 KB
testcase_39 AC 19 ms
8,188 KB
testcase_40 AC 23 ms
8,228 KB
testcase_41 WA -
testcase_42 AC 15 ms
7,800 KB
testcase_43 AC 18 ms
8,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
C = int(input())
V = int(input())
S = list(map(int,input().split()))
T = list(map(int,input().split()))
Y = list(map(int,input().split()))
M = list(map(int,input().split()))
INF = 1e8
dp = [[INF for i in range(C+1)] for j in range(N+1)]
dp[1][C] = 0
for i in range(1,N+1):
  for j in reversed(range(0,C+1)):
    if dp[i][j] != INF:
      for k in range(V):
        if i == S[k] and j - Y[k] >= 0:
          dp[T[k]][j - Y[k]] = min(dp[i][j] + M[k], dp[T[k]][j - Y[k]])
ans = INF
for i in range(1,C+1):
  ans = min(ans,dp[N][i])
print(ans if ans < INF else -1)
0