FineLine's blog

By FineLine, history, 8 years ago, In English

HI Everyone out there,Hope this post find you in best of your spirits.Yesterday I was attempting this SPOJ Problem here.I got the idea instantly that the state of dp will be defined as dp[node][flag] where flag denotes whether ticket has to be bought for this node or not.But I am having a hard time implementing it... Can somebody please help me in its implementation.Thanks and Have a nice day.

  • Vote: I like it
  • +3
  • Vote: I do not like it

| Write comment?
»
8 years ago, # |
  Vote: I like it +1 Vote: I do not like it

https://github.com/gabrielsimoes/codes/blob/master/SPOJEN/pt07f.cpp

Here is my solution. I tried to comment it so it will be easier to understand. The function that builds the lists of chains is a bit confuse. Just contact me if you have any doubts.

»
8 years ago, # |
Rev. 2   Vote: I like it +1 Vote: I do not like it

You may want to change your post title adding the problem name on SPOJ, so that people looking for some help on this problem may find this post easier.