Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Try rearranging the equation.
Once the equation is rearranged properly, think how a segment tree or a Fenwick tree can be used to solve the rearranged equation.
Iterate through the array backwards.