Querying Path Sums with Value Constraints in Trees Using Persistent Segment Trees

Problem Overview Given a tree with weighted nodes and multiple queries, each query asks for the sum of node weights along the path between two nodes x and y, where the weights fall within a specified range [l, r]. Solution Approach This problem can be efficiently solved using persistent segment trees (also known as chairman trees) combined with ...

Posted on Fri, 15 May 2026 17:00:54 +0000 by bigbob