結果
問題 | No.17 2つの地点に泊まりたい |
ユーザー | roiti46 |
提出日時 | 2015-02-16 00:05:46 |
言語 | PyPy2 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 512 bytes |
コンパイル時間 | 1,567 ms |
コンパイル使用メモリ | 77,396 KB |
実行使用メモリ | 77,816 KB |
最終ジャッジ日時 | 2023-09-06 01:29:41 |
合計ジャッジ時間 | 5,205 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | WA | - |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | RE | - |
ソースコード
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