← All problemsSign in

Maximum Median Matching

CodeChefRating 1647Open on judge ↗

$N$ boys and $N$ girls attend a dance class, where $N$ is **odd**. For today's practice session, they need to form $N$ boy-girl pairs. The $i$-th boy has a happiness value of $A_i$ and the $i$-th girl has a happiness value of $B_i$. A pair consisting of the $i$-th boy and the $j$-th girl has a happiness value of $A_i + B_j$. Let the happiness values of the $N$ pairs be $C_1, C_2, \ldots, C_N$. T

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