Adersity breeds strength.

Home

❯

算法笔记

❯

算法

❯

最短路

❯

02 0 - 1 BFS

02 0 - 1 BFS

2026年9月30日1分钟阅读

问题类型

  • 边权只有 0 和 1
  • 时间复杂度 O(n+m)

解决方法

使用 deque ,如果边权是 0 ,从前面放, 如果是 1 ,从后面放

题目链接
[https://www.luogu.com.cn/problem/AT_abc176_d]
[https://www.luogu.com.cn/problem/P4554]


关系图谱

Created with Quartz v5.0.0 © 2026

  • GitHub
  • Discord Community