結果

問題 No.1 道のショートカット
ユーザー Snark86Snark86
提出日時 2016-04-27 01:30:23
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 671 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 6,816 KB
実行使用メモリ 27,036 KB
最終ジャッジ日時 2024-07-08 04:27:20
合計ジャッジ時間 8,490 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
6,812 KB
testcase_01 AC 9 ms
6,940 KB
testcase_02 AC 10 ms
6,944 KB
testcase_03 AC 10 ms
6,944 KB
testcase_04 AC 10 ms
6,944 KB
testcase_05 AC 10 ms
6,944 KB
testcase_06 AC 10 ms
6,940 KB
testcase_07 AC 10 ms
6,940 KB
testcase_08 AC 13 ms
6,940 KB
testcase_09 AC 12 ms
6,944 KB
testcase_10 AC 13 ms
6,944 KB
testcase_11 AC 29 ms
6,940 KB
testcase_12 AC 20 ms
6,940 KB
testcase_13 AC 20 ms
6,940 KB
testcase_14 WA -
testcase_15 AC 9 ms
6,944 KB
testcase_16 WA -
testcase_17 AC 9 ms
6,940 KB
testcase_18 AC 10 ms
6,940 KB
testcase_19 AC 10 ms
6,940 KB
testcase_20 AC 12 ms
6,944 KB
testcase_21 AC 10 ms
6,944 KB
testcase_22 AC 10 ms
6,940 KB
testcase_23 AC 1,344 ms
14,336 KB
testcase_24 TLE -
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())

a = [[c,0,0]]
b = [[] for _ in range(n-1)]
d = [[] for _ in range(n-1)]
for i in range(v):
	b[s[i]-1].append([y[i],m[i],t[i]-1])
ans = []
while a:
	ac,at,ap = a.pop()
	for bi in b[ap]:
		bc,bt,bp = bi
		if ac >= bc:
			if bp == n-1:
				ans.append([ac-bc,at+bt])
			else:
				for dc,dt in d[bp]:
					if ac-bc >= dc and at+bt >= dt: break
				else:
					d[bp].append([ac-bc,at+bt])
					a.append([ac-bc,at+bt,bp])

print sorted(ans,key=lambda x:x[1])[0][1] if ans else -1
0