ZCO Little Red Riding Hood


I am trying to solve this problem(https://www.codechef.com/ZCOPRAC/problems/ZCO13002) This is the code I wrote


It fails on tasks 1, 3 and 7

Hi Archit;

Uncommented code is hard to comprehend, much like this solution which, however, works.


Sorry I’ll comment the code soon. However I fixed it on my own - http://pastebin.com/0mZwSQjn

Do you have a working solution for Rectangle? My code works fine but times out in the second sub task - http://pastebin.com/bEFStFD7

Hell guys, I am a naive coder, my question is, how to you guys think this dp algorithmn…it also becomes more tough for someone like me go thru such codes…and see what is happening actually, but once I get convinced with such solutions, I wonder how do you guys think in such dynamic manner, which I never ever imagined