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/3_Gold/Gold_SP.md
Benjamin Qi ffbd0e901a + slugs
2020-06-03 22:09:42 -04:00

2.6 KiB

slug title author
/gold/sp Gold - Shortest Path Benjamin Qi

Gold - Shortest Path

Author: Benjamin Qi

CPC.7

Find the shortest path where all edge weights are 1.

Tutorial

Problems

Non-Negative Edge Weights

Use Dijkstra's Algorithm.

Tutorial

USACO Gold Problems

All Pairs Shortest Path (APSP)

Use the Floyd-Warshall algorithm.

Tutorial

USACO Gold Problems

Negative Edge Weights

Hasn't appeared in recent USACO Gold as far as I know.

Can also modify Dijkstra's so it works with negative edge weights (but not negative cycles). The same running time bound no longer applies.