diff --git a/content/3_Gold/Gold_BIT.md b/content/3_Gold/Gold_BIT.md index 50aed46..d8330f0 100644 --- a/content/3_Gold/Gold_BIT.md +++ b/content/3_Gold/Gold_BIT.md @@ -83,8 +83,11 @@ Note that if it were not the case that all elements of the input array were dist * as far as I know, all gold problems have had only one possible output ... * [Out of Sorts (harder?)](http://www.usaco.org/index.php?page=viewproblem2&cpid=837) * Other Problems: + * [USACO Plat Mincross](http://www.usaco.org/index.php?page=viewproblem2&cpid=720) * [Mega Inversions](https://open.kattis.com/problems/megainversions) * also just inversion counting * [Out of Sorts (USACO Silver)](http://usaco.org/index.php?page=viewproblem2&cpid=834) * aka [Sorting Steps](https://csacademy.com/contest/round-42/task/sorting-steps/) [](42) - * Of course, this doesn't require anything other than sorting but fast range sum queries may make this easier. \ No newline at end of file + * Of course, this doesn't require anything other than sorting but fast range sum queries may make this easier. + * [Twin Permutations](https://www.hackerearth.com/practice/data-structures/advanced-data-structures/fenwick-binary-indexed-trees/practice-problems/algorithm/mancunian-and-twin-permutations-d988930c/description/) + * Offline 2D -> 1D \ No newline at end of file diff --git a/content/3_Gold/Gold_TopoSort.md b/content/3_Gold/Gold_TopoSort.md index 8b97076..e46b3e1 100644 --- a/content/3_Gold/Gold_TopoSort.md +++ b/content/3_Gold/Gold_TopoSort.md @@ -1,7 +1,7 @@ --- slug: /gold/topological-sort title: "Gold - Topological Sort" -author: Unknown +author: Benjamin Qi --- ## Gold - Topological Sort @@ -18,4 +18,4 @@ author: Unknown ### USACO Gold Problems - [Timeline](http://www.usaco.org/index.php?page=viewproblem2&cpid=1017) - - [Milking Order](http://www.usaco.org/index.php?page=viewproblem2&cpid=838) + - [Milking Order](http://www.usaco.org/index.php?page=viewproblem2&cpid=838) \ No newline at end of file diff --git a/content/4_Plat/Plat_1DRQ.md b/content/4_Plat/Plat_1DRQ.md index a79d21c..f99aa87 100644 --- a/content/4_Plat/Plat_1DRQ.md +++ b/content/4_Plat/Plat_1DRQ.md @@ -12,32 +12,61 @@ Author: Benjamin Qi ### Range Minimum Query - * Tutorial - * [Wikipedia](https://en.wikipedia.org/wiki/Range_minimum_query) - * (add) + - Tutorial + - [Wikipedia](https://en.wikipedia.org/wiki/Range_minimum_query) + - (add) -### General Static Range Queries +### General Static Range Queries (Online) -* Static range queries in $O(1)$ time and $O(N\log N)$ preprocessing for any associative operation? - * (add) + - Static range queries in $O(1)$ time and $O(N\log N)$ preprocessing for any associative operation + - (add) + +### Divide & Conquer + + - [DMOJ Continued Fractions](https://dmoj.ca/problem/dmopc19c7p4) + - [USACO Plat NonDec](http://www.usaco.org/index.php?page=viewproblem2&cpid=997) ## Segment Tree Author: Benjamin Qi -This data structure allows you to do point update and range query in $O(\log N)$ time each for any associative operation. +This data structure allows you to do point update and range query in $O(\log N)$ time each for any associative operation. In particular, note that **lazy** updates allow you to range updates as well. -* Tutorial - * CPH 9.3 - * [CSAcademy Tutorial](https://csacademy.com/lesson/segment_trees/) - * [cp-algorithms](https://cp-algorithms.com/data_structures/segment_tree.html) - * [Codeforces Tutorial](http://codeforces.com/blog/entry/18051) - * [Slides from CPC.3](https://github.com/SuprDewd/T-414-AFLV/tree/master/03_data_structures) + - Tutorial + - CPH 9.3 + - [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) -### Practice Problems - * [USACO Springboards](http://www.usaco.org/index.php?page=viewproblem2&cpid=995) - * can use segment tree with min query in place of the map mentioned in analysis - * [POI Cards](https://szkopul.edu.pl/problemset/problem/qpsk3ygf8MU7D_1Es0oc_xd8/site/?key=statement) [](81) - * [Counting Haybales (USACO Plat)](http://www.usaco.org/index.php?page=viewproblem2&cpid=578) - * Lazy Updates +### Problems + + - Normal SegTree + - [USACO Old Gold Seating](http://www.usaco.org/index.php?page=viewproblem2&cpid=231) (check ...) + - [USACO Old Gold Optimal Milking](http://www.usaco.org/index.php?page=viewproblem2&cpid=365) (check ...) + - [USACO Old Gold Marathon](http://www.usaco.org/index.php?page=viewproblem2&cpid=495) (check ...) + - [USACO Plat Balancing](http://www.usaco.org/index.php?page=viewproblem2&cpid=624) (check ...) + - [USACO Plat Nocross](http://www.usaco.org/index.php?page=viewproblem2&cpid=721) + - [USACO Gold Springboards](http://www.usaco.org/index.php?page=viewproblem2&cpid=995) + - can use segment tree with min query in place of the map mentioned in analysis + - [POI Cards](https://szkopul.edu.pl/problemset/problem/qpsk3ygf8MU7D_1Es0oc_xd8/site/?key=statement) [](81) + - Lazy Updates + - [USACO Old Gold The Lazy Cow](http://www.usaco.org/index.php?page=viewproblem2&cpid=418) (check ...) + - [USACO Plat Counting Haybales](http://www.usaco.org/index.php?page=viewproblem2&cpid=578) + +## BIT Revisited + +Binary Indexed Trees can support range increments in addition to range sum queries. + + - [GFG Range Update Point Query](https://www.geeksforgeeks.org/binary-indexed-tree-range-updates-point-queries/) + - [GFG Range Update Range Query](https://www.geeksforgeeks.org/binary-indexed-tree-range-update-range-queries/) + - [My Implementation](https://github.com/bqi343/USACO/blob/master/Implementations/content/data-structures/1D%20Range%20Queries%20(9.2)/BITrange.h) + +Example problem: + + - [DMOJ Range Update Range Query](https://dmoj.ca/problem/acc3p4) + +You can extend this to higher dimensions as well (USACO Camp - "Cows Play Global Thermonuclear War"). + + - [Paper](https://arxiv.org/pdf/1311.6093.pdf) diff --git a/content/4_Plat/Plat_2DRQ.md b/content/4_Plat/Plat_2DRQ.md index 834912a..1307f47 100644 --- a/content/4_Plat/Plat_2DRQ.md +++ b/content/4_Plat/Plat_2DRQ.md @@ -1,7 +1,40 @@ --- slug: /plat/2DRQ title: "Platinum - 2D Range Queries" -author: ? +author: Benjamin Qi --- -# Platinum - 2D Range Queries \ No newline at end of file +# Platinum - 2D Range Queries + +See [my implementations](https://github.com/bqi343/USACO/tree/master/Implementations/content/data-structures/2D%20Range%20Queries%20(15.2)). + +## Static Array Queries + + - [Multi-Dimensional RMQ (retrograd)](https://codeforces.com/blog/entry/53810) + - GP of Serbia 2020 B + +## 2D BIT + +### Tutorials + + - [GFG 2D BIT](https://www.geeksforgeeks.org/two-dimensional-binary-indexed-tree-or-fenwick-tree/) + - [TopCoder BIT](https://www.topcoder.com/community/competitive-programming/tutorials/binary-indexed-trees/) + +### Problems + + - [CSES Forest Queries II](https://cses.fi/problemset/task/1739) + - [DMOJ Soriya's Programming Project](https://dmoj.ca/problem/dmopc19c7p5) + - compressed 2D BIT + - or do divide & conquer with a 1D BIT + - [IOI 2007 Pairs](https://wcipeg.com/problem/ioi0722) + - [DMOJ Crowded Cities](https://dmoj.ca/problem/bfs17p6) + +## 2D Segment Tree + + - Short Description + - CSES 28.2, 28.4 + - Problems + - [USACO Plat Friendcross](http://www.usaco.org/index.php?page=viewproblem2&cpid=722) + - [USACO Plat Mowing](http://www.usaco.org/index.php?page=viewproblem2&cpid=601) + - [POI Tetris 3D](https://szkopul.edu.pl/problemset/problem/OQjANSOOD_-c38gh8p6g3Gxp/site/?key=statement) + - [IOI 2013 Game](http://wcipeg.com/problem/ioi1323) \ No newline at end of file diff --git a/content/4_Plat/Plat_Geo.md b/content/4_Plat/Plat_Geo.md index 92a63e6..7360b93 100644 --- a/content/4_Plat/Plat_Geo.md +++ b/content/4_Plat/Plat_Geo.md @@ -1,10 +1,50 @@ --- slug: /plat/geo title: "Platinum - Geometry" -author: ? +author: Benjamin Qi --- - - Cross product, dot product, geometry primitives (shoelace, etc.) - - Sweepline - - CPH 29, 30.1? - - Convex Hull \ No newline at end of file +# Platinum - Geometry + +## Primitives + +You should know basic operations like cross product and dot product. For platinum specifically, you should be fine as long as you know how to code convex hull. + +### Tutorial + + - CPH 29, 30.1 + - [TopCoder](https://www.topcoder.com/community/competitive-programming/tutorials/geometry-concepts-basic-concepts/) + - [CF - Point Class](https://codeforces.com/blog/entry/48122) + - [C++ - std::complex](https://codeforces.com/blog/entry/22175) + - [cp-algo - "Elementary Operations"](https://cp-algorithms.com/) + - [vlecomte - geo book](https://codeforces.com/blog/entry/59129) + - [My Templates](https://github.com/bqi343/USACO/tree/master/Implementations/content/geometry%20(13)/Primitives) + +## Sweep Line + + - [TopCoder Line Sweep](https://www.topcoder.com/community/competitive-programming/tutorials/line-sweep-algorithms/) + - [Cow Steepchase II (Silver)](http://www.usaco.org/index.php?page=viewproblem2&cpid=943) + - :| + +## Convex Hull + + - [Kattis Convex Hull](https://open.kattis.com/problems/convexhull) + +### Tutorial + + - Graham Scan + - [cp-algo](https://cp-algorithms.com/geometry/grahams-scan-convex-hull.html) + - [My Implementation](https://github.com/bqi343/USACO/blob/master/Implementations/content/geometry%20(13)/Polygons/ConvexHull2.h) + - Monotone Chain + - CPH 30.3 (brief) + - [Wikipedia](https://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain) + - [My Implementation](https://github.com/bqi343/USACO/blob/master/Implementations/content/geometry%20(13)/Polygons/ConvexHull%20(13.2).h) + +### Problems + + - [USACO Plat Balance](http://www.usaco.org/index.php?page=viewproblem2&cpid=864) + - [USACO Plat Falling](http://www.usaco.org/index.php?page=viewproblem2&cpid=998) + - [USACO Old Gold - Fencing](http://www.usaco.org/index.php?page=viewproblem2&cpid=534) + - [USACO Old Gold - Cow Curling](http://www.usaco.org/index.php?page=viewproblem2&cpid=382) + - [AGC 44 Random Pawn](https://atcoder.jp/contests/agc044/tasks/agc044_e) + - Generalization of "Balance" \ No newline at end of file diff --git a/content/4_Plat/Plat_Graphs.md b/content/4_Plat/Plat_Graphs.md new file mode 100644 index 0000000..cd776a6 --- /dev/null +++ b/content/4_Plat/Plat_Graphs.md @@ -0,0 +1,13 @@ +--- +slug: /plat/trees +title: "Platinum - Graphs" +author: ? +--- + +SCC + +[USACO Old Gold Grass](http://www.usaco.org/index.php?page=viewproblem2&cpid=516) + +BCC + +[USACO Plat Push a Box](http://www.usaco.org/index.php?page=viewproblem2&cpid=769) \ No newline at end of file diff --git a/content/4_Plat/Plat_Trees.md b/content/4_Plat/Plat_Trees.md index f6d5f9d..6a4793f 100644 --- a/content/4_Plat/Plat_Trees.md +++ b/content/4_Plat/Plat_Trees.md @@ -1,13 +1,49 @@ --- slug: /plat/trees title: "Platinum - Trees" -author: ? +author: Benjamin Qi --- # Platinum - Trees - - CPH 14, 18? - - hasn’t been *required* aside from - - *probably* won't see a repeat of this - - [Milk Visits](http://www.usaco.org/index.php?page=viewproblem2&cpid=970) also mentions it - - but no binary jumping required ... \ No newline at end of file +## Tree Diameter + +### Tutorial + + - CPH 14.2 + +### Problems + + - [USACO Plat Newbarns](http://www.usaco.org/index.php?page=viewproblem2&cpid=817) + - Copy of [Brain Network "Hard"](https://codeforces.com/contest/690/problem/C3) + +## Lowest Common Ancestor + +### Tutorial + + - CPH 18 + - [cp-algorithms: Lowest Common Ancestor](https://cp-algorithms.com/) + +### Problems + + - [USACO Plat Max Flow](http://www.usaco.org/index.php?page=viewproblem2&cpid=576) + - [USACO Gold Milk Visits](http://www.usaco.org/index.php?page=viewproblem2&cpid=970) + - [USACO Gold Cow Land](http://www.usaco.org/index.php?page=viewproblem2&cpid=921) + - LCA + BIT + - [USACO Plat Promote](http://www.usaco.org/index.php?page=viewproblem2&cpid=696) + - Subtree + BIT + - [USACO Plat Disrupt](http://www.usaco.org/index.php?page=viewproblem2&cpid=842) + - HLD is possible, but just do binary jumps + - [USACO Plat Tree Boxes](http://www.usaco.org/index.php?page=viewproblem2&cpid=948) + - interactive!! + - [USACO Plat Gathering](http://www.usaco.org/index.php?page=viewproblem2&cpid=866) + - [USACO Plat Exercise](http://www.usaco.org/index.php?page=viewproblem2&cpid=901) + - tricky + +## Centroid Decomposition + + - [USACO Plat - At Large](http://www.usaco.org/index.php?page=viewproblem2&cpid=793) + - very tricky + - [DMOJ Bob Equilibrium](https://dmoj.ca/problem/dmopc19c7p6) + +## Heavy-Light Decomposition