← All problemsSign in

Mishra and his sons

Mishra has $N$ sons. He has $N$ candies and $N$ cookies . 1. the ith candy has a price $a_i$ , where all the ai are pairwise distinct (i.e. all $a_i$ are different), 2. the ith cookie has a price $b_i$ , where all the bi are pairwise distinct (i.e. all $b_i$ are different). Mishra wants to give only one candy and only one cookie to each of his sons. To make sure that all of them ge

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