--- id: RURQ title: "Range Update Range Query" author: Benjamin Qi prerequisites: - Gold - Point Update Range Query description: Lazy updates on segment trees and two binary indexed trees in conjunction. frequency: 1 --- import { Problem } from "../models"; export const metadata = { problems: { bitSample: [ new Problem("SPOJ", "Horrible Queries", "HORRIBLE", "Easy", false, ["BIT-Range"], ""), ], bitProb: [ new Problem("CSES", "Polynomial Queries", "1736", "Normal", false, ["BIT-Range"], "equivalent to https://dmoj.ca/problem/acc3p4"), ], lazySample: [ new Problem("CSES", "Range Updates & Sums", "1735", "Easy", false, ["Lazy SegTree"], ""), ], lazySegTree: [ new Problem("YS", "Range Affine Range Sum", "range_affine_range_sum", "Easy", false, ["Lazy SegTree"], ""), new Problem("Plat", "Counting Haybales", "578", "Easy", false, ["Lazy SegTree"], ""), new Problem("Old Gold", "The Lazy Cow", "418", "Easy", false, ["Lazy SegTree"], ""), ], lazySegCnt: [ new Problem("CSES", "Area of Rectangles", "1741", "Hard", false, ["Lazy SegTree"], ""), new Problem("HR", "Strange Tree", "https://www.hackerrank.com/contests/openbracket-2017/challenges/special-path-on-a-strange-tree/problem", "Hard", false, ["Lazy SegTree"]), ], segTreeBeats: [ new Problem("YS", "Range Chmin Chmax Add Range Sum", "range_chmin_chmax_add_range_sum", "Very Hard", false, ["SegTreeBeats"], ""), ], } }; ## BIT Revisited Binary Indexed Trees can support range increments in addition to range sum queries. ### Tutorial [My Implementation](https://github.com/bqi343/USACO/blob/master/Implementations/content/data-structures/1D%20Range%20Queries%20(9.2)/BITrange.h) ### Problems ## Lazy Segment Tree ### Tutorial - CPH 28.1 (Segment Trees Revisited) ### Problems ## Lazy Segment Tree - Counting Minimums use segment tree that keeps track of minimum and # of minimums ## Segment Tree Beats ### Tutorial ### Problems (300iq insane problem)