This repository has been archived on 2022-06-22. You can view files and clone it, but cannot push or open issues or pull requests.
usaco-guide/content/5_Gold/PURQ.mdx
2020-06-26 17:12:04 -04:00

48 lines
1.6 KiB
Text

---
id: PURQ
title: "Point Update Range Query"
author: Benjamin Qi
prerequisites:
description: Range queries for any associative operation over an array with updates using segment tree.
frequency: 1
---
import { Problem } from "../models";
export const metadata = {
problems: {
sample: [
new Problem("YS", "Point Set Range Composite", "point_set_range_composite", "Intro", false, ["PURQ"], ""),
],
probs: [
new Problem("CSES", "Range Minimum Queries II", "1649", "Intro", false, ["PURQ"], ""),
new Problem("Gold", "Springboards", "995", "Normal", false, ["PURQ"], "min segtree"),
new Problem("Plat", "Nocross", "721", "Normal", false, ["PURQ"], "LIS variation"),
]
}
};
<problems-list problems={metadata.problems.sample} />
A **segment tree** allows you to do point update and range query in $O(\log N)$ time each for any associative operation.
<info-block title="Pro Tip">
For gold, you only need to know the basics (ex. sum, min queries). More advanced applications (such as *lazy propagation*) are restricted to platinum.
</info-block>
### Tutorials
- CPH 9.3 (Segment Trees)
- [PAPS 11.2.3](https://www.csc.kth.se/~jsannemo/slask/main.pdf)
- [Codeforces Tutorial](http://codeforces.com/blog/entry/18051)
- [CSAcademy Tutorial](https://csacademy.com/lesson/segment_trees/)
- [cp-algorithms](https://cp-algorithms.com/data_structures/segment_tree.html)
- [Slides from CPC.3](https://github.com/SuprDewd/T-414-AFLV/tree/master/03_data_structures)
### Problems
Can also try solving some of the BIT questions w/ segtree.
<problems-list problems={metadata.problems.general} />