Decomposition of Paths

Revision en5, by aloo_parantha, 2020-12-27 09:14:13

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:

5 2 3 1 4 1 1 5 2 5 3 3 2 5

Output :

8 4

Can anyone please explain this problem with an example... Problem Link : https://www.hackerearth.com/problem/algorithm/path-decomposition-ii-ad4b4a0c/

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en5 English aloo_parantha 2020-12-27 09:14:13 76
en4 English aloo_parantha 2020-12-27 09:13:14 31
en3 English aloo_parantha 2020-12-27 09:12:34 26
en2 English aloo_parantha 2020-12-27 09:12:02 94
en1 English aloo_parantha 2020-12-27 09:10:37 749 Initial revision (published)