#P5291. Rescue Mission: Igniting Jupiter
Rescue Mission: Igniting Jupiter
Rescue Mission: Igniting Jupiter
You are given a tree with n nodes (called turning engines) connected by n - 1 edges; any two nodes can be reached via a unique simple path and the distance between two nodes is defined as the number of edges on that path.
There are k rescue teams. Each team must choose a rescue range – a connected subset S of nodes – subject to the following condition. A node u in S is called a center of S if for every node v in S the distance \(d(u,v)\) is at most \(L\) (in \(\LaTeX\: format, L\) is the given constant). A rescue range is considered valid if there exists at least one node in the set which can serve as its center. Note that different rescue ranges may even be identical or share common nodes.
The deployment of the rescue plan is a scheme which is a choice of one valid rescue range for each rescue team. A scheme is considered feasible if there exists at least one node u (called a common center) such that for every team the chosen rescue range S satisfies both u ∈ S and \(d(u,v)\le L\) for all v ∈ S.
Your task is to count the number of feasible deployment schemes modulo 998244353
.
Overview: In other words, first note that a rescue range S is valid if its radius is at most \(L\) (i.e. there exists a node u in S with \(\max_{v\in S}d(u,v)\le L\)). Then a deployment scheme \(\{S_1, S_2,\dots,S_k\}\) is feasible if and only if there exists some node u that is a center for every chosen rescue range. Two schemes are considered different if for at least one team the chosen rescue range is different.
Even if the answer is huge, you only need to output it modulo 998244353
. May hope light the way!
inputFormat
The first line contains three integers n, k and L (— the number of nodes, the number of rescue teams and the time limit, respectively).
Each of the next n - 1 lines contains two integers u and v (1-indexed) indicating that there is an edge between nodes u and v.
outputFormat
Output a single integer, the total number of feasible deployment schemes modulo 998244353
.
sample
1 1 0
1