#P9414. 「NnOI R1-T3」元组

「NnOI R1-T3」元组

Background

Little L really likes trees, really likes LCA\operatorname{LCA}, and really likes ordered tuples, so this problem was created.

Problem Description

For a rooted tree with nn nodes (the root is 11), define a strictly increasing ordered pp-tuple (a1,a2,,ap)(a_1,a_2,\ldots,a_p) to be a level-kk LCA\operatorname{LCA} pp-tuple if and only if:

  • 1a1<a2<<apn1 \le a_1 < a_2 < \ldots < a_p \le n.
  • There exists a node xx such that for any strictly increasing ordered kk-tuple bab \subseteq a, we have LCAi=1k{bi}=x\operatorname{LCA}_{i=1}^{k}\{b_i\} = x.

Note that LCA(x,y)\operatorname{LCA}(x,y) means the lowest common ancestor of nodes xx and yy in the tree, and LCAi=1k{bi}\operatorname{LCA}_{i=1}^{k}\{b_i\} means the LCA\operatorname{LCA} of all bib_i.

Find the number of level-kk LCA\operatorname{LCA} pp-tuples, modulo 109+710^9+7.

Input Format

The first line contains three integers n,p,kn,p,k.

The next n1n-1 lines each contain two integers, representing the endpoints of an edge.

Output Format

Output one integer, the required answer.

6 4 3
1 2
2 3
3 4
3 5
3 6
1
6 3 2
1 2
1 3
1 4
1 5
1 6
20
6 4 2
1 2
1 3
2 4
2 5
3 6
0

Hint

Sample 1 Explanation

For sample 11, we find that the only valid 44-tuple is (3,4,5,6)(3,4,5,6).

Constraints

For 100%100\% of the testdata, 2n50002 \le n \le 5000, and 2kpn2 \le k \le p \le n.

Note: This problem uses bundled testcases.

  • Subtask 1 (10 pts): n10n \le 10.
  • Subtask 2 (20 pts): n20n \le 20.
  • Subtask 3 (30 pts): n500n \le 500.
  • Subtask 4 (10 pts): Node 11 has a direct edge to every node.
  • Subtask 5 (30 pts): No special restrictions.

Contributors

data&check: EstasTonne. (The problem setter of the next problem number under this problem in the problemset.)

Translated by ChatGPT 5