← All problemsSign in

Cersei and her Soldiers

CodeChefRating 2917Open on judge ↗

**Cersei** wants to be the queen of seven kingdoms. For this to happen, she needs to address the soldiers in her army. There are $n$ soldiers in her army (numbered $1$ through $n$). Cersei passes on the message to the **first soldier (soldier 1)**. This message needs to reach **every soldier in the army**. For this, the soldiers communicate among themselves by one soldier passing the message

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