← All problemsSign in

Trial of the Conqueror

CodeChefRating 2732Open on judge ↗

Evenvalue, the king of the even numbers has now set out to conquer the leaves of a rooted tree. The tree has $N$ nodes (numbered from $1$ to $N$) and is rooted at node $1$, which Evenvalue is currently on. In one move, he can do the following - - If the current node $U$ is a leaf, consider it conquered, choose $X$ such that $1 \le X \le K$, and move to the $X^{th}$ ancestor of $U$ (if it exists

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start