結果

問題 No.1 道のショートカット
ユーザー tabataba
提出日時 2016-04-12 17:34:52
言語 Python2
(2.7.18)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 557 bytes
コンパイル時間 655 ms
コンパイル使用メモリ 6,588 KB
実行使用メモリ 7,036 KB
最終ジャッジ日時 2023-09-22 12:41:58
合計ジャッジ時間 2,505 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,184 KB
testcase_01 AC 11 ms
6,048 KB
testcase_02 AC 11 ms
6,032 KB
testcase_03 AC 11 ms
6,196 KB
testcase_04 AC 12 ms
6,192 KB
testcase_05 AC 11 ms
6,044 KB
testcase_06 AC 11 ms
5,984 KB
testcase_07 AC 12 ms
6,108 KB
testcase_08 AC 17 ms
6,244 KB
testcase_09 AC 15 ms
6,164 KB
testcase_10 AC 18 ms
6,244 KB
testcase_11 AC 23 ms
6,460 KB
testcase_12 AC 26 ms
6,240 KB
testcase_13 AC 23 ms
6,312 KB
testcase_14 AC 12 ms
6,080 KB
testcase_15 RE -
testcase_16 AC 13 ms
6,092 KB
testcase_17 RE -
testcase_18 AC 12 ms
6,004 KB
testcase_19 AC 11 ms
6,228 KB
testcase_20 AC 12 ms
6,072 KB
testcase_21 AC 12 ms
6,096 KB
testcase_22 AC 12 ms
6,032 KB
testcase_23 AC 31 ms
7,036 KB
testcase_24 AC 22 ms
6,644 KB
testcase_25 AC 13 ms
6,088 KB
testcase_26 AC 12 ms
6,276 KB
testcase_27 AC 26 ms
6,628 KB
testcase_28 AC 12 ms
5,968 KB
testcase_29 AC 23 ms
6,508 KB
testcase_30 AC 14 ms
6,116 KB
testcase_31 AC 19 ms
6,412 KB
testcase_32 AC 17 ms
6,244 KB
testcase_33 AC 15 ms
6,216 KB
testcase_34 AC 25 ms
6,708 KB
testcase_35 AC 16 ms
6,296 KB
testcase_36 AC 16 ms
6,456 KB
testcase_37 AC 16 ms
6,184 KB
testcase_38 AC 12 ms
6,024 KB
testcase_39 AC 12 ms
6,236 KB
testcase_40 AC 13 ms
6,240 KB
testcase_41 AC 11 ms
6,088 KB
testcase_42 RE -
testcase_43 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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