結果

問題 No.1 道のショートカット
ユーザー pluto77pluto77
提出日時 2016-07-05 08:51:02
言語 Python2
(2.7.18)
結果
AC  
実行時間 79 ms / 5,000 ms
コード長 575 bytes
コンパイル時間 581 ms
コンパイル使用メモリ 6,680 KB
実行使用メモリ 6,532 KB
最終ジャッジ日時 2023-09-27 21:57:13
合計ジャッジ時間 2,895 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
6,056 KB
testcase_01 AC 10 ms
5,936 KB
testcase_02 AC 10 ms
5,928 KB
testcase_03 AC 10 ms
5,848 KB
testcase_04 AC 10 ms
5,980 KB
testcase_05 AC 9 ms
5,880 KB
testcase_06 AC 11 ms
5,876 KB
testcase_07 AC 9 ms
5,864 KB
testcase_08 AC 20 ms
6,120 KB
testcase_09 AC 14 ms
6,244 KB
testcase_10 AC 18 ms
6,132 KB
testcase_11 AC 35 ms
6,052 KB
testcase_12 AC 55 ms
6,532 KB
testcase_13 AC 52 ms
6,380 KB
testcase_14 AC 11 ms
6,068 KB
testcase_15 AC 11 ms
5,892 KB
testcase_16 AC 13 ms
6,044 KB
testcase_17 AC 11 ms
6,096 KB
testcase_18 AC 11 ms
6,064 KB
testcase_19 AC 12 ms
6,100 KB
testcase_20 AC 15 ms
6,092 KB
testcase_21 AC 12 ms
5,940 KB
testcase_22 AC 11 ms
5,980 KB
testcase_23 AC 79 ms
6,112 KB
testcase_24 AC 78 ms
6,028 KB
testcase_25 AC 21 ms
5,948 KB
testcase_26 AC 14 ms
5,976 KB
testcase_27 AC 60 ms
6,300 KB
testcase_28 AC 10 ms
5,976 KB
testcase_29 AC 21 ms
6,032 KB
testcase_30 AC 13 ms
5,976 KB
testcase_31 AC 18 ms
6,072 KB
testcase_32 AC 24 ms
6,236 KB
testcase_33 AC 17 ms
6,200 KB
testcase_34 AC 62 ms
6,232 KB
testcase_35 AC 12 ms
6,084 KB
testcase_36 AC 14 ms
6,116 KB
testcase_37 AC 12 ms
6,040 KB
testcase_38 AC 10 ms
5,884 KB
testcase_39 AC 12 ms
6,080 KB
testcase_40 AC 11 ms
6,088 KB
testcase_41 AC 10 ms
5,880 KB
testcase_42 AC 10 ms
6,092 KB
testcase_43 AC 12 ms
6,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#coding: utf-8
#yuki_001

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())

INF=float("inf")

dp=[[INF for i in xrange(c+1)] for j in xrange(n)]
dp[0][0]=0
G=[[] for i in xrange(n)]
for i in xrange(v):
 G[s[i]-1].append((t[i]-1,y[i],m[i]))
 
for i in xrange(n):
 for j in xrange(c+1):
  if dp[i][j]!=INF:
   for t,y,m in G[i]:
    if j+y<=c:
     dp[t][j+y]=min(dp[t][j+y],dp[i][j]+m)

res=min(dp[n-1])
if res==INF:
 print -1
else:
 print res
0