Hints

Posted by

decay 16 Feb 2019 23:41

1. This problem can be reduced to the following:

Given X, find two vertices such that path weight is equal to X.

2. It probably cannot be solved with naiive DP. Use centroid decomposition.

3. std::unordered_map gets TL while std::map gets AC.