Fireworks
You are given a tree $T$ containing $N$ vertices. Let $F$ be a subset of vertices of $T$. $F$ is called an *$x$-rooted fireworks*, if it satisfies the following conditions: 1. $F$ contains the vertex $x$. 2. $F$ is a connected subset of $T$ - or more formally, the [induced subgraph](https://en.wikipedia.org/wiki/Induced_subgraph) $T[F]$ is connected. 3. Let $d_F(u)$ denote the degree of node $u$
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start