|
||||||||||
PermutationTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 148 Accepted Submission(s): 41 Problem Description Alice get a rooted tree that has N nodes. Every node has an unique id from 1 to N. Alice want to change the tree to a permutation. If for all nodes, all sons in its subtree is before it, we call the permutation is good. Now Alice wanna know the sum of the number of inversion pair of all good permutations. Output the answer mod 1000000007. Input The input contains multiple test cases. For each test case, the first line contains two integers $N(1\leq N\leq 50)$,$ROOT(1\leq ROOT\leq N)$. Then N-1 lines, every line contains two integers U, V. The given tree is legal. Output For each test case output the answer mod 1000000007. Sample Input
Sample Output
Author ZSTU Source | ||||||||||
|