Week 11 | Range Updates and Range Maximums
27 April, 2021
What was discussed?
-
Forest Queries
: subgrid sum queries.
-
Salary Queries
: how to use ordered sets.
-
Pizzeria Queries
: dealing with absolute values in ds problems.
Prerequisite: Dynamic Range Minimum Queries
-
Problem: Maintain a data structure which supports the following
updates and querys on an array $A$ (initially all $A[i]$ are $0$)-
- $\texttt{update}(l, r, x)$: do $A[i] := A[i] + x$ for all $i \in [l, r]$.
- $\texttt{query}(l, r)$: find $\max_{i=l}^{r} A[i]$.
Solution using square root decomposition and segment tree with lazy propagation.
Recording
References