← All problemsSign in

Subtract 12 Operation

CodeChefRating 1991Open on judge ↗

You are given $N$ integers $A_1, A_2, \ldots, A_N$. You can perform the following operation any number of times: - Select any index $i$ such that $1 \le i \le (N-1)$; - Subtract $1$ from $A_i$ and $2$ from $A_{i+1}$. Find the **smallest** possible value of $|A_1| + |A_2| + \ldots + |A_N|$ you can achieve after performing any number of given operations. ### Input - The first line of input will

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