#P9042. [PA 2021] Zbiory niezależne
[PA 2021] Zbiory niezależne
Problem Description
A tree is a simple undirected connected graph with no cycles. In this problem, we consider -colored trees, i.e., trees in which each node has one of colors.
Two colored trees and are equal if and only if:
- There exists a bijection such that for any pair of nodes , if and only if .
- For any node , the color of node in is the same as the color of node in .
We call an independent set of a tree any subset of nodes such that no two different nodes in are connected by an edge. The size of an independent set is the number of nodes in .
Given three integers , , and , find how many different -colored trees have a maximum independent set size in . Since the answer may be very large, output it modulo .
Input Format
One line with three integers , , and .
Output Format
One line with one integer, the required value.
1 3 1
9
1 3 2
149
Hint
For of the testdata, and .
Translated by ChatGPT 5