← All problemsSign in

Maximize an Expression

CodeChefRating 1809Open on judge ↗

Chef had three sequences of real numbers $k_1, k_2, \ldots, k_N$, $c_1, c_2, \ldots, c_N$ and $x_1, x_2, \ldots, x_N$. Unfortunately, he lost the sequence $x$; the only thing he remembers about it is that $$x_1 \cdot k_1 + x_2 \cdot k_2 + \ldots + x_N \cdot k_N = 0 \,.$$ Chef's favourite expression is $$\sqrt{x_1+c_1} + \sqrt{x_2+c_2} + \ldots + \sqrt{x_N+c_N} \,.$$ Its value is defined only if $

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