Data Structures19 sections · 729 units
Open in Course

Problem - Polynomial Queries

Harder range updates

Given an array of nn integers and qq queries:

1.1. Update: add 1,2,3,...,(rl+1)1, 2, 3, ..., (r-l+1) to positions l,l+1,...,rl, l+1, ..., r

2.2. Query: return sum(l,r)sum(l, r) Constraints: n,q2105n, q \leq 2 \cdot 10^5. This is a challenge for both segment trees and sqrt decomposition. The update isn't uniform, it's a polynomial pattern. Think about what you need to store per block to handle this efficiently.