← All problemsSign in

Families of Chefland

CodeChefRating 2893Open on judge ↗

Chefland is inhabited by chefs, which have only one gender. Each chef can, alone, give birth to many younger chefs, which can then give birth to even younger chefs, and so on. It is easy to see that the family structure of any chef (formed by this chef's direct and indirect descendants) is a tree. A *family* is a tree such that its root does not have a parent, i.e. it is not a proper subtree of a

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