結果

問題 No.1 道のショートカット
ユーザー gahougahou
提出日時 2016-11-10 17:53:00
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 650 bytes
コンパイル時間 1,027 ms
コンパイル使用メモリ 6,528 KB
実行使用メモリ 10,632 KB
最終ジャッジ日時 2023-09-22 12:51:42
合計ジャッジ時間 7,948 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
5,984 KB
testcase_01 AC 12 ms
5,864 KB
testcase_02 AC 12 ms
6,088 KB
testcase_03 AC 12 ms
5,892 KB
testcase_04 AC 11 ms
5,840 KB
testcase_05 AC 12 ms
5,940 KB
testcase_06 AC 12 ms
5,936 KB
testcase_07 AC 14 ms
5,940 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(raw_input())
C=int(raw_input())
V=int(raw_input())
S=map(int,raw_input().split())
T=map(int,raw_input().split())
Y=map(int,raw_input().split())
M=map(int,raw_input().split())
yCost=[[10**5]*N for _ in xrange(N)]
mCost=[[10**5]*N for _ in xrange(N)]
for i in xrange(V):
  yCost[S[i]-1][T[i]-1] = Y[i]
  mCost[S[i]-1][T[i]-1] = M[i]
dp=[[10**9]*(C+1) for _ in xrange(N)]
dp[0][C]=0
for _ in xrange(N):
  for i in xrange(V):
    for j in xrange(C+1):
      if j+Y[i]>C: continue
      dp[T[i]-1][j] = min(dp[T[i]-1][j], dp[S[i]-1][j+Y[i]]+M[i])
ans = 10**9
for i in xrange(C+1):
  ans = min(ans, dp[N-1][i])
if ans==10**9: print -1
else: print ans
0