From a9b13209ea4ac8ed6a6ec3f392e49651ec669d0d Mon Sep 17 00:00:00 2001 From: Benjamin Qi Date: Wed, 3 Jun 2020 17:42:26 -0400 Subject: [PATCH] update README, DP --- content/3_Gold/Gold_DP.md | 134 ++++++++++++++++++++----------------- content/3_Gold/Gold_MST.md | 3 + content/README.md | 33 ++++----- 3 files changed, 93 insertions(+), 77 deletions(-) diff --git a/content/3_Gold/Gold_DP.md b/content/3_Gold/Gold_DP.md index a104244..e6d4ff0 100644 --- a/content/3_Gold/Gold_DP.md +++ b/content/3_Gold/Gold_DP.md @@ -5,74 +5,84 @@ Author: Michael Cao Assumes familiarity with prefix sums, recursion, Bit Operations (for Bitmask DP), and Trees (for Tree DP). ## Introduction to DP -* CPH Chapter 7 -* [Topcoder DP](https://www.topcoder.com/community/competitive-programming/tutorials/dynamic-programming-from-novice-to-advanced/) -* [HackerRank DP](https://www.hackerrank.com/topics/dynamic-programming) + + * CPH 7 + * [HackerRank DP](https://www.hackerrank.com/topics/dynamic-programming) + * [Topcoder DP](https://www.topcoder.com/community/competitive-programming/tutorials/dynamic-programming-from-novice-to-advanced/) ## Classical DP Problems + Tutorials for most problems (excluding USACO) can be found on Chapter 7 of CPH. -* Knapsack - * [Unbounded](https://www.hackerrank.com/challenges/unbounded-knapsack/problem) - * [0/1](https://www.hackerrank.com/contests/srin-aadc03/challenges/classic-01-knapsack/problem) - * [Large Capacity + Small Values](https://atcoder.jp/contests/dp/tasks/dp_e) - * [Talent Show](http://www.usaco.org/index.php?page=viewproblem2&cpid=839) -* Longest Increasing Subsequence - * [LIS in Quadratic Time](https://leetcode.com/problems/longest-increasing-subsequence/) - * Try to improve to $O(NlogN)$. - * [Sort It Out](http://www.usaco.org/index.php?page=viewproblem2&cpid=865) -* Coin Change - * [Unordered](https://cses.fi/problemset/task/1635) - * [Ordered](https://cses.fi/problemset/task/1636) - * [Minimum Coins](https://cses.fi/problemset/task/1634) -* Paths on a Grid - * [Count Paths](https://atcoder.jp/contests/dp/tasks/dp_h) - * [Palindromic Paths](http://www.usaco.org/index.php?page=viewproblem2&cpid=553) -* Edit Distance - * [Standard](https://www.hackerrank.com/contests/cse-830-homework-3/challenges/edit-distance) - * [Landscaping (Silver)](http://www.usaco.org/index.php?page=viewproblem2&cpid=126) -* Longest Common Subsequence - * [Standard](https://leetcode.com/problems/longest-common-subsequence/) + + * Knapsack + * [Unbounded](https://www.hackerrank.com/challenges/unbounded-knapsack/problem) + * [0/1](https://www.hackerrank.com/contests/srin-aadc03/challenges/classic-01-knapsack/problem) + * [Large Capacity + Small Values](https://atcoder.jp/contests/dp/tasks/dp_e) + * [Talent Show (USACO Gold)](http://www.usaco.org/index.php?page=viewproblem2&cpid=839) + * [Fruit Feast (USACO Gold)](http://www.usaco.org/index.php?page=viewproblem2&cpid=574) + * Longest Increasing Subsequence + * [LIS in Quadratic Time](https://leetcode.com/problems/longest-increasing-subsequence/) + * Try to improve to $O(NlogN)$. + * [Sort It Out (USACO Platinum)](http://www.usaco.org/index.php?page=viewproblem2&cpid=865) + * Coin Change + * [Unordered](https://cses.fi/problemset/task/1635) + * [Ordered](https://cses.fi/problemset/task/1636) + * [Minimum Coins](https://cses.fi/problemset/task/1634) + * Paths on a Grid + * [Count Paths](https://atcoder.jp/contests/dp/tasks/dp_h) + * [Palindromic Paths (Old USACO Gold)](http://www.usaco.org/index.php?page=viewproblem2&cpid=553) + * Edit Distance + * [Standard](https://www.hackerrank.com/contests/cse-830-homework-3/challenges/edit-distance) + * [Landscaping (Silver)](http://www.usaco.org/index.php?page=viewproblem2&cpid=126) + * Longest Common Subsequence + * [Standard](https://leetcode.com/problems/longest-common-subsequence/) ## Tree DP -* Tutorials: - * [DP on Trees (Codeforces)](https://codeforces.com/blog/entry/20935) -* Problems - * [Subtree](https://atcoder.jp/contests/dp/tasks/dp_v) - * [Independent Set](https://atcoder.jp/contests/dp/tasks/dp_p) - * [Barn Painting](http://www.usaco.org/index.php?page=viewproblem2&cpid=766) - * [Delegation](http://usaco.org/index.php?page=viewproblem2&cpid=1019) + + * Tutorial + * [DP on Trees (Codeforces)](https://codeforces.com/blog/entry/20935) + * Problems + * [Subtree](https://atcoder.jp/contests/dp/tasks/dp_v) + * [Independent Set](https://atcoder.jp/contests/dp/tasks/dp_p) + * [Barn Painting (USACO Gold)](http://www.usaco.org/index.php?page=viewproblem2&cpid=766) + * [Delegation (USACO Gold)](http://usaco.org/index.php?page=viewproblem2&cpid=1019) ## Bitmask DP -* Tutorials: - * CPH Chapter 10 - * [Dynamic Programming Over Subsets (Codeforces)](https://codeforces.com/blog/entry/337) - * [Dynamic Programming and Bit Masking (HackerEarth)](https://www.hackerearth.com/practice/algorithms/dynamic-programming/bit-masking/tutorial/) -* Problems: - * [Moovie Moving](http://www.usaco.org/index.php?page=viewproblem2&cpid=515) - * [Matching](https://atcoder.jp/contests/dp/tasks/dp_o) - * [Square Subsets](https://codeforces.com/contest/895/problem/C) - * [Guards in the Storehouse](https://codeforces.com/problemset/problem/845/F) + +Note: Has not appeared on recent USACO. + + * Tutorials: + * CPH Chapter 10 + * [Dynamic Programming Over Subsets (Codeforces)](https://codeforces.com/blog/entry/337) + * [Dynamic Programming and Bit Masking (HackerEarth)](https://www.hackerearth.com/practice/algorithms/dynamic-programming/bit-masking/tutorial/) + * Problems: + * [Moovie Moving (Old UASCO Gold)](http://www.usaco.org/index.php?page=viewproblem2&cpid=515) + * [Matching](https://atcoder.jp/contests/dp/tasks/dp_o) + * [Square Subsets](https://codeforces.com/contest/895/problem/C) + * [Guards in the Storehouse](https://codeforces.com/problemset/problem/845/F) ## Practice Problems -* [Atcoder DP Contest (Extremely Good)](https://atcoder.jp/contests/dp/tasks) -* [CSES DP Section](https://cses.fi/problemset/list/) -* USACO (Not Ordered By Difficulty) - * [Delegation](http://www.usaco.org/index.php?page=viewproblem2&cpid=1019) - * [Time is Mooney](http://www.usaco.org/index.php?page=viewproblem2&cpid=993) - * [Mortal Cowmbat](http://usaco.org/index.php?page=viewproblem2&cpid=971) - * [Snakes](http://www.usaco.org/index.php?page=viewproblem2&cpid=945) - * [Painting the Barn](http://usaco.org/index.php?page=viewproblem2&cpid=923) - * [Cow Poetry (Fast Exponentiation)](http://usaco.org/index.php?page=viewproblem2&cpid=897) - * [Teamwork](http://usaco.org/index.php?page=viewproblem2&cpid=863) - * [Talent Show](http://www.usaco.org/index.php?page=viewproblem2&cpid=839) - * [Taming the Herd](http://www.usaco.org/index.php?page=viewproblem2&cpid=815) - * [Stamp Painting](http://www.usaco.org/index.php?page=viewproblem2&cpid=791) - * [Why Did The Cow Cross the Road I](http://www.usaco.org/index.php?page=viewproblem2&cpid=717) - * [Why Did The Cow Cross the Road II](http://www.usaco.org/index.php?page=viewproblem2&cpid=718) - * [Hoof Paper Scissors](http://www.usaco.org/index.php?page=viewproblem2&cpid=694) - * [Cow Checklist](http://www.usaco.org/index.php?page=viewproblem2&cpid=670) - * [Circular Barn Revisited](http://www.usaco.org/index.php?page=viewproblem2&cpid=622) - * [Radio Contact](http://www.usaco.org/index.php?page=viewproblem2&cpid=598) - * [248](http://www.usaco.org/index.php?page=viewproblem2&cpid=647) - * [Fruit Feast](http://www.usaco.org/index.php?page=viewproblem2&cpid=574) -* [Codeforces DP Problem List](http://codeforces.com/blog/entry/325) + + * [Atcoder DP Contest (Extremely Good)](https://atcoder.jp/contests/dp/tasks) + * [CSES DP Section](https://cses.fi/problemset/list/) + * [Codeforces DP Problem List](http://codeforces.com/blog/entry/325) + * USACO (Not Ordered By Difficulty) + * [Time is Mooney](http://www.usaco.org/index.php?page=viewproblem2&cpid=993) + * Graph + * [Mortal Cowmbat](http://usaco.org/index.php?page=viewproblem2&cpid=971) + * with Prefix Sums + * [Painting the Barn](http://usaco.org/index.php?page=viewproblem2&cpid=923) + * with 2D Prefix Sums + * [Snakes](http://www.usaco.org/index.php?page=viewproblem2&cpid=945) + * [Cow Poetry](http://usaco.org/index.php?page=viewproblem2&cpid=897) + * with fast Exponentiation + * [Teamwork](http://usaco.org/index.php?page=viewproblem2&cpid=863) + * [Taming the Herd](http://www.usaco.org/index.php?page=viewproblem2&cpid=815) + * [Stamp Painting](http://www.usaco.org/index.php?page=viewproblem2&cpid=791) + * [Why Did The Cow Cross the Road I](http://www.usaco.org/index.php?page=viewproblem2&cpid=717) + * [Why Did The Cow Cross the Road II](http://www.usaco.org/index.php?page=viewproblem2&cpid=718) + * [Hoof Paper Scissors](http://www.usaco.org/index.php?page=viewproblem2&cpid=694) + * [Cow Checklist](http://www.usaco.org/index.php?page=viewproblem2&cpid=670) + * [Circular Barn Revisited](http://www.usaco.org/index.php?page=viewproblem2&cpid=622) + * [Radio Contact](http://www.usaco.org/index.php?page=viewproblem2&cpid=598) + * [248](http://www.usaco.org/index.php?page=viewproblem2&cpid=647) diff --git a/content/3_Gold/Gold_MST.md b/content/3_Gold/Gold_MST.md index c3d7651..4acd19e 100644 --- a/content/3_Gold/Gold_MST.md +++ b/content/3_Gold/Gold_MST.md @@ -8,8 +8,11 @@ - CPH 15 - Prim's Algorithm + - [cp-algo](https://cp-algorithms.com/graph/mst_prim.html) - Similar to Dijkstra - Kruskal's Algorithm + - [cp-algo 1](https://cp-algorithms.com/graph/mst_kruskal.html) + - [cp-algo 2](https://cp-algorithms.com/graph/mst_kruskal_with_dsu.html) - Requires "Disjoint Set Union" (DSU) data structure - [CSAcademy Disjoint-Set](https://csacademy.com/lessons) - DSU Complexity Proofs (optional of course) diff --git a/content/README.md b/content/README.md index 0ba2d64..4ef0fd2 100644 --- a/content/README.md +++ b/content/README.md @@ -33,14 +33,14 @@ # Silver - Greedy - - ex? + - ex. [Lemonade Stand](http://usaco.org/index.php?page=viewproblem2&cpid=835) - Standard Containers - - ex? + - ex. [Convention II](http://usaco.org/index.php?page=viewproblem2&cpid=859) - Sorting - Binary Search (BinSearch) - ex. [Counting Haybales](http://usaco.org/index.php?page=viewproblem2&cpid=666) - - Two Pointers (2P) - - ex. [Diamond Collector](http://usaco.org/index.php?page=viewproblem2&cpid=643) + - Two Pointers (2P) + - ex. [Diamond Collector](http://usaco.org/index.php?page=viewproblem2&cpid=643) - Prefix Sums (Psum) - ex. [Breed Counting](http://www.usaco.org/index.php?page=viewproblem2&cpid=572) - Flood Fill (FF) @@ -54,8 +54,6 @@ - Dynamic Programming (DP) - ex. [Time is Mooney](http://www.usaco.org/index.php?page=viewproblem2&cpid=993) - - Sliding Window? - - ex. [Haybale Feast](http://www.usaco.org/index.php?page=viewproblem2&cpid=767) - Graphs - Breadth First Search (BFS) - ex. [Cow Navigation](http://www.usaco.org/index.php?page=viewproblem2&cpid=695) @@ -70,15 +68,15 @@ - ex. [Haircut](http://www.usaco.org/index.php?page=viewproblem2&cpid=1041) - Number Theory - ex. [Cow Poetry](http://usaco.org/index.php?page=viewproblem2&cpid=897) - - Geometry - - ex. ? - - Strings - - Trie? - - Hashing - - ex. [Cownomics](http://www.usaco.org/index.php?page=viewproblem2&cpid=741) - - Combinatorics - - Principle of Inclusion and Exclusion (PIE) - - ex. [Cowpatibility](http://usaco.org/index.php?page=viewproblem2&cpid=862) + - Less Common + - Strings + - Hashing + - ex. [Cownomics](http://www.usaco.org/index.php?page=viewproblem2&cpid=741) + - Combinatorics + - Principle of Inclusion and Exclusion (PIE) + - ex. [Cowpatibility](http://usaco.org/index.php?page=viewproblem2&cpid=862) + - Sliding Window + - ex. [Haybale Feast](http://www.usaco.org/index.php?page=viewproblem2&cpid=767) # Platinum @@ -88,6 +86,8 @@ Just a sampling of the many possible topics. - Lowest Common Ancestor (LCA) - mostly platinum but may appear in gold as well - ex. [cowland](http://www.usaco.org/index.php?page=viewproblem2&cpid=921) + - Heavy-Light Decomposition (HLD) + - Tree Diameter - Range Queries - Segment Tree - possibly useful for gold @@ -99,3 +99,6 @@ Just a sampling of the many possible topics. - ex. [Landscaping](http://www.usaco.org/index.php?page=viewproblem2&cpid=650) - Fracturing Search - ex. [Robotic Cow Herd](http://www.usaco.org/index.php?page=viewproblem2&cpid=674) + - Geometry + - Convex Hull + - ignoring Cow Steeplechase II (Silver) ...