← All problemsSign in

F - Minimize Minimum

You are given an array $a$ of length $n$, where $n$ is even. You need to partition $a$ into two disjoint subsequences$^\dagger$ $s_1$ and $s_2$ of length $\dfrac{n}{2}$ each such that the minimum value of $\left|s_1[i] - s_2[i]\right|$ over $1 \le i \le \dfrac{n}{2}$ is as small as possible. More formally, you need to choose two disjoint subsequences $s_1$ and $s_2$ from $a$, each containing ex

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