Chefland Army
**This is not intended to be the tie-break problem.** In the Chefland army, there are $M$ generals (numbered $1$ through $M$) and $N$ soldiers (numbered $1$ through $N$). The Army has a vertical hierarchy ― a soldier may command many other soldiers (including zero), but each soldier has at most one commander. A soldier $y$ is a *subordinate* of a soldier $x$ if soldier $x$ is the commander o
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