← All problemsSign in

Find the Sum

CodeChefRating 1923Open on judge ↗

There is a secret sequence $A_1, A_2, \ldots, A_N$. We do not know the elements of this sequence, but we know another sequence $B_1, B_2, \ldots, B_{N-1}$ such that $B_i = A_i + A_{i+1}$ for each valid $i$. You should process $Q$ queries. In each query, you are given two indices $p$ and $q$; your task is to compute $A_p + A_q$ or determine that there is not enough information to uniquely determin

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