How do you usually implement HLD with segment tree?
Heavy-Light Decomposition with segment tree.
Do you flatten the tree by DFS (prioritizing the heavy child) and use a single segment tree over the whole array,
or build a separate segment tree for each chain?
Full text and comments »
Same code,different time.
In my lasy content,224960717 got TLE in c++14,and 224966171 got AC in c++20.The codes are same.Why is the difference?
Leetcode Weekly 498 Solution Discussion