結果
問題 |
No.1 道のショートカット
|
ユーザー |
|
提出日時 | 2015-05-06 22:40:02 |
言語 | Python2 (2.7.18) |
結果 |
WA
|
実行時間 | - |
コード長 | 627 bytes |
コンパイル時間 | 185 ms |
コンパイル使用メモリ | 7,040 KB |
実行使用メモリ | 13,724 KB |
最終ジャッジ日時 | 2024-07-08 03:56:22 |
合計ジャッジ時間 | 8,028 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 6 WA * 1 TLE * 1 -- * 32 |
ソースコード
def search(num, money, routes, nowTime): minTime = 10000000000 time = minTime*2 for i in xrange(0,routes): if (x[i][1] == num) & (x[i][2] <= money): if x[i][0] == 1: time = x[i][3] else: time = search(x[i][0], money - x[i][2], i, nowTime+x[i][3]) if time < minTime: minTime = time return minTime+nowTime n = input() c = input() v = 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()) x = sorted(zip(s,t,y,m), key=lambda x:x[1]) result = search(n,c,v,0) if result == 10000000000: result = -1 print result