結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,868 KB
testcase_01 AC 15 ms
7,760 KB
testcase_02 AC 16 ms
7,892 KB
testcase_03 AC 16 ms
7,900 KB
testcase_04 AC 15 ms
7,788 KB
testcase_05 AC 16 ms
7,956 KB
testcase_06 AC 16 ms
7,896 KB
testcase_07 AC 16 ms
7,956 KB
testcase_08 AC 271 ms
8,540 KB
testcase_09 AC 44 ms
8,280 KB
testcase_10 AC 90 ms
8,304 KB
testcase_11 AC 224 ms
8,296 KB
testcase_12 AC 1,128 ms
8,836 KB
testcase_13 AC 1,083 ms
8,764 KB
testcase_14 AC 17 ms
8,216 KB
testcase_15 AC 16 ms
8,324 KB
testcase_16 AC 20 ms
8,280 KB
testcase_17 AC 16 ms
8,244 KB
testcase_18 AC 17 ms
7,764 KB
testcase_19 AC 19 ms
8,252 KB
testcase_20 AC 51 ms
8,356 KB
testcase_21 AC 26 ms
8,376 KB
testcase_22 AC 19 ms
8,276 KB
testcase_23 AC 472 ms
8,228 KB
testcase_24 AC 456 ms
8,292 KB
testcase_25 AC 87 ms
8,240 KB
testcase_26 AC 51 ms
8,296 KB
testcase_27 AC 569 ms
8,304 KB
testcase_28 AC 16 ms
7,824 KB
testcase_29 WA -
testcase_30 AC 20 ms
7,796 KB
testcase_31 AC 47 ms
8,356 KB
testcase_32 AC 217 ms
8,272 KB
testcase_33 AC 93 ms
8,416 KB
testcase_34 AC 455 ms
8,184 KB
testcase_35 AC 18 ms
8,200 KB
testcase_36 WA -
testcase_37 AC 17 ms
8,288 KB
testcase_38 AC 17 ms
7,780 KB
testcase_39 AC 19 ms
8,300 KB
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 15 ms
7,956 KB
testcase_43 AC 17 ms
8,312 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(i,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(C+1):
  ans = min(ans,dp[N][i])
print(ans if ans < INF else -1)
0