Getting tle in using Common segtree in HLD, but not in Different segtree for each heavy path

Revision en2, by shashankagrawal, 2020-07-17 01:58:04

Can any one help me with why this solution is getting TLE, are the constants too high? My solution is here in which I made single segment tree for whole of the tree And the one which got AC, in which I made different segtree for each heavy path, is here

Edit :- Got it now, Thanks to jef

Tags heavy light, #segment-trees, #trees

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English shashankagrawal 2020-07-17 01:58:04 64 Tiny change: '/86944276)' -> '/86944276)\n\nEdit :- Got it now, Thanks to [user:bessiethecow]'
en1 English shashankagrawal 2020-07-16 01:15:55 463 Heavy Light Decomposition, Trees, Segment Tree (published)