bristy1588's blog

By bristy1588, 11 years ago, In English

Hello there, Can anyone please help me out with this? Problem : http://www.spoj.com/problems/BTCODE_G/

I am getting RE(Segmentation Fault). i tried doing the DFS with Stack but it doesnt help.

Here is my code:http://paste.ubuntu.com/5583070//

My Algo is: First i do an inorder traversal of the tree. Then i keep a BIT for every colour. When they ask me to colour a node, i add +1 to the BIT WITH ID start time, and -1 to the BIT with ID endtym. Then i find the number of nodes that are of the colour of node a, in the path from a-->b.

Please help me.

  • Vote: I like it
  • -5
  • Vote: I do not like it

»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Did You solve it? If yes, please tell me. What was your Idea?