BIRTHDAY
CodeChefOpen on judge ↗
Chef birthday is coming soon. His friend sage gifted an array $a$ of length $n$ with positive integers, but chef only likes an array if it is $balanced$. Let's call an array balanced if for any two, not necessarily different, numbers $x$ and $y$ from this array, $x≥y$, the number $⌊x/y⌋$ (x divided by y with rounding down) is also in this array. You are guaranteed that all numbers in $a$ do not e
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