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

53 lines
1.8 KiB
Text
Raw Normal View History

2020-06-22 01:45:24 +00:00
---
2020-06-22 14:26:06 +00:00
id: PURQ
2020-06-23 17:27:41 +00:00
title: "Point Update Range Query"
2020-06-22 01:45:24 +00:00
author: Benjamin Qi
prerequisites:
2020-06-26 21:12:04 +00:00
description: Range queries for any associative operation over an array with updates using segment tree.
frequency: 1
2020-06-22 01:45:24 +00:00
---
2020-06-25 02:09:35 +00:00
import { Problem } from "../models";
export const metadata = {
problems: {
sample: [
2020-06-26 21:12:04 +00:00
new Problem("YS", "Point Set Range Composite", "point_set_range_composite", "Intro", false, ["PURQ"], ""),
2020-06-25 04:00:28 +00:00
],
2020-06-27 03:07:31 +00:00
general: [
2020-06-26 21:12:04 +00:00
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"),
]
2020-06-25 02:09:35 +00:00
}
};
<problems-list problems={metadata.problems.sample} />
2020-06-27 03:07:31 +00:00
<br/>
2020-06-26 21:12:04 +00:00
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>
2020-06-22 01:45:24 +00:00
### Tutorials
2020-06-27 00:33:06 +00:00
<resources>
2020-06-27 03:07:31 +00:00
<resource source="CSA" title="Segment Trees" url="segment_trees" starred>interactive</resource>
<resource source="CF" title="Efficient and easy segment trees" url="blog/entry/18051" starred>simple implementation</resource>
<resource source="CPH" title="9.3 - Segment Trees" starred>same implementation as above</resource>
2020-06-27 00:33:06 +00:00
<resource source="cp-algo" title="Segment Tree" url="data_structures/segment_tree.html"></resource>
2020-06-27 03:07:31 +00:00
<resource source="PAPS" title="11.2.3"></resource>
2020-06-27 00:33:06 +00:00
<resource source="CPC" title="3 - Data Structures" url="03_data_structures"></resource>
</resources>
2020-06-22 01:45:24 +00:00
### Problems
2020-06-26 21:12:04 +00:00
Can also try solving some of the BIT questions w/ segtree.
2020-06-25 04:00:28 +00:00
2020-06-26 21:12:04 +00:00
<problems-list problems={metadata.problems.general} />