← All problemsSign in

Add Subtract Equalize

CodeChefRating 2759Open on judge ↗

Chef has an array $A$ of length $N$. In one operation, Chef can do the following: - Select any non-empty subsequence $S = \{S_1, S_2, S_3, \ldots S_k\}$ of $A$ (where the $S_i$ are the **indices** of the array representing the chosen subsequence) - Then, choose one index from this subsequence, say $S_j$ - Finally, either add $A_{S_j}$ to every element of the subsequence, or subtract $A_{S_j}$ fr

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