結果
問題 |
No.17 2つの地点に泊まりたい
|
ユーザー |
|
提出日時 | 2015-02-16 00:05:46 |
言語 | PyPy2 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 512 bytes |
コンパイル時間 | 1,033 ms |
コンパイル使用メモリ | 76,844 KB |
実行使用メモリ | 77,060 KB |
最終ジャッジ日時 | 2024-06-23 20:34:24 |
合計ジャッジ時間 | 4,380 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 1 RE * 26 |
ソースコード
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