SPOJ QTREE — Runtime Error [HLD + SEGMENT TREE]

Revision en3, by PiasRoY, 2020-04-14 17:49:40

Update: The problem was in my 'decompose' function. Its return type was 'int' though I didn't return anything, so I changed it into 'void' and I got AC. Weird but worked.

I tried to solve this problem using HLD and Segment Tree. I didn't find LCA explicitly rather used HLD.

Code: https://pastebin.ubuntu.com/p/BfxMZH9hz3/

This solution gives runtime error. I can't find any reason for this kind of verdict.

I have already read this blog but couldn't understand why my code isn't working.

Can anyone help me?

Tags hld, spoj, spoj qtree

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English PiasRoY 2020-04-14 17:49:40 3 Tiny change: 'oblem was my 'decom' -> 'oblem was in my 'decom'
en2 English PiasRoY 2019-10-29 00:21:39 176
en1 English PiasRoY 2019-10-09 12:05:15 456 Initial revision (published)