随笔分类 - BFS
摘要:纠正我对 01 BFS 问题的错误认识。 我一直以为对于 01 BFS,每次点 出队时,对于 的邻接边表中的边,只要先松弛边权为 0 的边再松弛边权为 1 的边就能保证 每个点只入队一次 。最近我发现我错了,例子: 按照上述做法,入队序列是 1, 2, 3, 4, 5, 4, 5。4
阅读全文
摘要:传送门POUR1 - Pouring water#gcd#recursionGiven two vessels, one of which can accommodatealitres of water and the other -blitres of water, determine the n...
阅读全文