Chefina and Prefix Suffix Sums
Chefina likes prefix and suffix sums, so Chef decided to give some to her as her birthday present. He created a sequence $a_1, a_2, \ldots, a_N$ and calculated its prefix sums $pre_1, pre_2, \ldots, pre_N$ (for each valid $i$, $pre_i$ is the sum of the first $i$ elements of $a$) and suffix sums $suf_1, suf_2, \ldots, suf_N$ (for each valid $i$, $suf_i$ is the sum of the last $i$ elements of $a$).
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.
Sign in to chat with the tutor and save your progress.
Sign in to start