← All problemsSign in

Asya & Coloring

Asya is a very intelligent girl and she comes up with very fascinating games to entertain herself. On her b'day she got gifts from Uncle Sai. He gifted her M marbles and a tree with N nodes with each edge of 1-unit length. Asya could keep M marbles in the nodes of the tree and then see them roll from one node to some other node where the marble stops. A marble always ends at some other node than

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