the problem = http://usaco.org/index.php?page=viewproblem2&cpid=213
i am trying to implement the second idea on the analysis (the one with heaps).
analysis: http://usaco.org/current/data/sol_runaway.html
my code: http://ideone.com/2bjocS It is having segmantation fault on the tests 5 to 10. Array sizes are right and i have no idea why couldt it be having segment. Is it about recursion stack limit or something? Please help me out.