← All problemsSign in

Encrypt Value

CodeChefRating 1633Open on judge ↗

You are given an array $A$ containing $N$ integers. Consider the following process: - Let $S = 0$ initially. - For each $i$ from $1$ to $N$ **in order**, update $S$ to either $(S+A_i)$ or $(S\times A_i)$. That is, either add $A_i$ to $S$ or multiply $S$ by $A_i$. Before performing the process, you're allowed to freely rearrange the elements of $A$ as you like. If you choose the rearrangement

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