Logo
(追記) (追記ここまで)

32472번 - Simple Tree Decomposition Problem 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 (추가 시간 없음) 1024 MB (추가 메모리 없음)210816140.667%

문제

BOOM! Dohoon’s head has exploded while solving the tree decomposition practice problem given as an assignment while attending the Summer School on Combinatorics and Algorithms at KAIST. Dohoon’s brain, now unable to focus on the problem, is idling away time performing ‘decomposition’ on a ‘tree’ instead of doing tree decomposition on general graphs.

Specifically, Dohoon is given a tree with $N$ vertices. He plans to decompose the tree into a collection of connected components as follows:

  1. Dohoon will select zero or more edges from the tree and remove them from the tree. Let $S$ be the set of removed edges in this procedure.
  2. After the edges in $S$ are removed, each connected component in the resulting graph must have either $A$ or $B$ vertices.

Help Dohoon find the number of different ways to decompose the tree as given above. To be specific, determine the number of possible sets of edges $S$ that satisfy the given conditions.

Note that a tree is a connected, acyclic, undirected graph, where each undirected edge is an unordered pair of vertices.

입력

The first line contains three space-separated integers, $N,ドル $A,ドル $B$.

The $i$-th of the following $N-1$ lines contains two space-separated integers $x_i$ and $y_i,ドル denoting that the $i$-th edge connects vertices $x_i$ and $y_i$ in the tree.

출력

Print the number of possible sets $S$ that satisfy the conditions given in the problem, modulo 10ドル^9+7$.

제한

  • 1ドル\le N\le 100,円 000$
  • 1ドル\le A<B\le 500$
  • 1ドル\le x_i<y_i\le N$ (1ドル\le i\le N-1$)
  • It is guaranteed that the given edges form a tree.

예제 입력 1

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

예제 출력 1

10

힌트

출처

University > KAIST > KAIST ICPC Mock Competition > 2024 KAIST 14th ICPC Mock Competition L번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /