Блог пользователя bristy1588

Автор bristy1588, 11 лет назад, По-английски

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.

  • Проголосовать: нравится
  • -5
  • Проголосовать: не нравится

»
6 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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