joker70's blog

By joker70, history, 4 weeks ago, In English,

I have been stuck on this problem for a long time. I am learning Heavy-Light Decomposition.

So, I got tried to solve this. It's a normal HLD base problem for testing HLD, as mentioned in a blog. But I couldn't get AC. I am getting wrong answer verdict on test case 7. This is my code.

Can somebody help, please?

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

»
4 weeks ago, # |
  Vote: I like it +24 Vote: I do not like it

You forgot to assign nxt[1]=1 before calling the hld function.

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Still wrong answer on #7. :(

    • »
      »
      »
      4 weeks ago, # ^ |
        Vote: I like it +24 Vote: I do not like it

      I've noticed another bug. In the line 133 you should put st[v] instead of v.

      • »
        »
        »
        »
        4 weeks ago, # ^ |
          Vote: I like it +18 Vote: I do not like it

        Really thanks sir. It means a lot to me. I am feeling so relieved right now.