You are given a tree that contains vertices and queries. Each query is determining the number of decompositions of the tree into paths and the path from to that is one of the paths in the decomposition modulo 998244353.
A tree decomposition in paths is valid if each vertex belongs to exactly one path. A path can be a single vertex. Two decompositions are different if there are two vertices and that belong to the same path in one of the decompositions but two distinct paths in the other.
Sample Input:
Can anyone please explain this problem with an example... Problem Link : https://www.hackerearth.com/problem/algorithm/path-decomposition-ii-ad4b4a0c/