From 98b532aa4728ae4d889a0f079207a92c159da946 Mon Sep 17 00:00:00 2001 From: Benjamin Qi Date: Wed, 3 Jun 2020 17:08:42 -0400 Subject: [PATCH] + graph probs --- content/3_Gold/Gold_MST.md | 5 ++++- content/3_Gold/Gold_ShortestPath.md | 33 ++++++++++++++++++----------- content/3_Gold/Gold_TopoSort.md | 4 ++++ 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/content/3_Gold/Gold_MST.md b/content/3_Gold/Gold_MST.md index a4dd14a..c3d7651 100644 --- a/content/3_Gold/Gold_MST.md +++ b/content/3_Gold/Gold_MST.md @@ -1,6 +1,8 @@ # Gold - Minimum Spanning Tree - * [Kattis Minimum Spanning Tree](https://open.kattis.com/problems/minspantree) + - [Kattis Minimum Spanning Tree](https://open.kattis.com/problems/minspantree) + - [CSES Road Reparation](https://cses.fi/problemset/task/1675) + - equivalent to above ## Tutorial @@ -23,6 +25,7 @@ - also special ... - DSU Problems - [Mootube](http://www.usaco.org/index.php?page=viewproblem2&cpid=789) + - same as [CSES Road Construction](https://cses.fi/problemset/task/1676) - [Closing the Farm](http://www.usaco.org/index.php?page=viewproblem2&cpid=646) - [Favorite Colors](http://www.usaco.org/index.php?page=viewproblem2&cpid=1042) - fairly tricky \ No newline at end of file diff --git a/content/3_Gold/Gold_ShortestPath.md b/content/3_Gold/Gold_ShortestPath.md index b80b439..df22a17 100644 --- a/content/3_Gold/Gold_ShortestPath.md +++ b/content/3_Gold/Gold_ShortestPath.md @@ -6,6 +6,10 @@ Author: Benjamin Qi ## Breadth First Search +Find the shortest path where all edge weights are 1. + + * [CSES Message Route](https://cses.fi/problemset/task/1667) + ### Tutorial - [CSAcademy BFS](https://csacademy.com/lesson/breadth_first_search) @@ -17,49 +21,54 @@ Author: Benjamin Qi - [Cow Navigation](http://www.usaco.org/index.php?page=viewproblem2&cpid=695) - [Dream](http://www.usaco.org/index.php?page=viewproblem2&cpid=575) - [Lasers](http://www.usaco.org/index.php?page=viewproblem2&cpid=671) + * [Monsters](https://cses.fi/problemset/task/1194) -## Shortest Path - -### Non-Negative Edge Weights +## Non-Negative Edge Weights * [Kattis SSSP Non-Negative](https://open.kattis.com/problems/shortestpath1) + * [CSES Shortest Routes I](https://cses.fi/problemset/task/1671) + * [CSES Flight Discount](https://cses.fi/problemset/task/1195) + * [CSES Flight Routes](https://cses.fi/problemset/task/1196) + * [CSES Investigation](https://cses.fi/problemset/task/1202) -For non-negative weights, use *Dijkstra's Algorithm:* +Use *Dijkstra's Algorithm*. -#### Tutorial +### Tutorial * CSES 13.2 * [cp-algo Dijkstra (Dense Graphs)](https://cp-algorithms.com/graph/dijkstra_sparse.html) * [cp-algo Dijkstra (Sparse Graphs)](https://cp-algorithms.com/graph/dijkstra_sparse.html) * Usually, it's this one that's applicable. -#### USACO Gold Problems +### USACO Gold Problems * [Milk Pumping](http://www.usaco.org/index.php?page=viewproblem2&cpid=969) * fairly standard application * [Shortcut](http://usaco.org/index.php?page=viewproblem2&cpid=899) * [Fine Dining](http://usaco.org/index.php?page=viewproblem2&cpid=861) -### All Pairs +## All Pairs Shortest Path (APSP) - * [Kattis All Pairs Shortest Path](https://open.kattis.com/problems/allpairspath) + * [CSES Shortest Routes II](https://cses.fi/problemset/task/1672) + * [Kattis APSP (with negative weights)](https://open.kattis.com/problems/allpairspath) Use the *Floyd-Warshall* algorithm. -#### Tutorial +### Tutorial * CSES 13.3 * [cp-algo Floyd-Warshall](https://cp-algorithms.com/graph/all-pair-shortest-path-floyd-warshall.html) -#### USACO Gold Problems +### USACO Gold Problems * [Moortal Cowmbat](http://usaco.org/index.php?page=viewproblem2&cpid=971) * Use APSP before running DP. -### Negative Edge Weights +## Negative Edge Weights Hasn't appeared in recent USACO Gold as far as I know. + * [CSES High Score](https://cses.fi/problemset/task/1673) * [Kattis SSSP Negative](https://open.kattis.com/problems/shortestpath3) -Can also modify Dijkstra's so it works with negative edge weights but not negative cycles. Running time bound no longer applies. +Can also modify Dijkstra's so it works with negative edge weights (but not negative cycles). The same running time bound no longer applies. diff --git a/content/3_Gold/Gold_TopoSort.md b/content/3_Gold/Gold_TopoSort.md index f30401e..c17f51b 100644 --- a/content/3_Gold/Gold_TopoSort.md +++ b/content/3_Gold/Gold_TopoSort.md @@ -1,5 +1,9 @@ ## Gold - Topological Sort + - [CSES Course Schedule](https://cses.fi/problemset/task/1679) + - [CSES Longest Flight Route](https://cses.fi/problemset/task/1680) + - [CSES Game Routes](https://cses.fi/problemset/task/1681) + ### Tutorial - CPH 16.1, 16.2