Rigged Game
In a video game country, there are $N$ cities connected by $N-1$ bi-directional roads, forming a tree network. The $i_{th}$ city has an integer associated with it, called difficulty $D_i$. A game map is represented by a pair of integers $(X,Y)$, such that $(1\leq X\leq N)$ and $(0 \leq Y \leq {N-1})$. All nodes within a distance $Y$ from the node $X$ are included in this game map. (Note that the
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