結果

問題 No.1 道のショートカット
ユーザー tabataba
提出日時 2016-04-12 17:03:52
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 359 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 6,668 KB
実行使用メモリ 87,832 KB
最終ジャッジ日時 2023-09-22 12:42:19
合計ジャッジ時間 10,926 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,128 KB
testcase_01 AC 12 ms
5,976 KB
testcase_02 AC 11 ms
6,188 KB
testcase_03 AC 11 ms
6,188 KB
testcase_04 AC 11 ms
6,112 KB
testcase_05 AC 12 ms
6,116 KB
testcase_06 AC 11 ms
5,980 KB
testcase_07 AC 11 ms
6,080 KB
testcase_08 AC 1,251 ms
6,480 KB
testcase_09 AC 85 ms
6,260 KB
testcase_10 AC 2,474 ms
7,732 KB
testcase_11 TLE -
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 #

l=lambda:map(int,raw_input().split())
n=input()
c=input()
v=input()
s=l()
t=l()
y=l()
m=l()
r=[(0,0,[1])]
g=[]
while len(r)>0:
	a=r.pop(0)
	for i in [i for i in range(v)if s[i]==a[2][-1]]:
		b=(a[0]+y[i],a[1]+m[i],a[2]+[t[i]])
		if b[0]<=c:
			if b[2][-1]==n:
				g+=[b]
			else:
				r+=[b]
if len(g)>0:
	a=min(g,key=lambda x:x[1])
	print a[1]
else:
	print -1
0