The Dothrakis
CodeChefOpen on judge ↗
The Dothraki Army is arranged on the battlefield in the form of a tree where each node represents a dothraki soldier. The soldiers are numbered from $1$ to $N$. Each soldier has some strength $A_i$. A $k$-connected group of soldiers is defined as a connected subgraph of the given tree of soldiers which contains exactly $k$ soldiers(nodes). The overall strength of any $k$-connected group of soldier
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