← All problemsSign in

Winter Is Here

CodeChefRating 3120Open on judge ↗

You will be given two arrays $A$ and $B$, each of length $N$. For some value $K$, let's call an array $C$ `good` if it satisfies the following conditions: - $0\le C_i \le B_i$ for $(1 \le i \le N)$ - **At least** $K$ elements in the array must be equal to $0$. - $\sum_{i=1}^N A_i = \sum_{i=1}^N C_i $ Among all the `good` arrays $C$, let $result(K)$ denote the **minimum** value of $\sum_{i=1}^N |

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