結果
問題 | No.1 道のショートカット |
ユーザー | roiti46 |
提出日時 | 2015-02-16 00:05:59 |
言語 | PyPy2 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 512 bytes |
コンパイル時間 | 1,956 ms |
コンパイル使用メモリ | 77,536 KB |
実行使用メモリ | 89,984 KB |
最終ジャッジ日時 | 2023-09-22 11:58:31 |
合計ジャッジ時間 | 7,956 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 73 ms
76,372 KB |
testcase_01 | AC | 74 ms
76,368 KB |
testcase_02 | AC | 74 ms
76,304 KB |
testcase_03 | AC | 73 ms
76,132 KB |
testcase_04 | AC | 73 ms
76,328 KB |
testcase_05 | AC | 78 ms
76,196 KB |
testcase_06 | AC | 75 ms
76,172 KB |
testcase_07 | AC | 74 ms
76,472 KB |
testcase_08 | AC | 107 ms
79,448 KB |
testcase_09 | AC | 97 ms
79,364 KB |
testcase_10 | AC | 122 ms
80,096 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 | -- | - |
ソースコード
inf = 10**9 def get_paths(n,cost,time): if n == N-1: return time res = inf for i in xrange(n+1,N): for y,m in G[n][i]: if cost+y > C: continue res = min(res,get_paths(i,cost+y,time+m)) return res N,C,V = [int(raw_input()) for i in range(3)] S,T,Y,M = [map(int,raw_input().split()) for i in range(4)] G = [[[] for i in xrange(N)] for j in xrange(N)] for s,t,y,m in zip(S,T,Y,M): G[s-1][t-1].append([y,m]) ans = get_paths(0,0,0) print ans if ans < inf else -1