← All problemsSign in

Smallest Cost

Nitin is planning to host a party for new year. He has invited B boys and G girls. He wants the party to be full of fun and excitement . He has calculated the fun to be $(B&X)&(G&X)$ where $X$ is the money he spends for fun, and excitement to be $(B&Y)|(G&Y)$ where $Y$ is the money he spends for excitement. Help him in calculating the minimum amount he spends such that the fun and excitement shoul

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