← All problemsSign in

Sum this up

CodeChefRating 2018Open on judge ↗

You are given an array $A$ with $N$ **positive** elements $A_1, A_2, \dots, A_N$. You are also given a function $S$ on any array $C$ with length $N$ defined as follow: $S(C)$ = $\sum\limits_{i=1}^{N}(\dfrac{C_{i-1} + C_{i+1}}{2}-C_i)$ **Note** that conventionally, we define all elements outside the range of the array to have value $0$. In this context, $C_0 = C_{N + 1} = 0$. Consider the follo

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