最短路
为啥不能重名
这个作者很懒,什么都没留下…
展开
-
单源最短路的应用与扩展
单元最短路与别的知识点的结合:1.二分2.拓扑排序3.全排列/枚举4.动态规划/记忆化搜索dp5.从多个起点到多个终点求最短路,可以设置一个虚拟点或者当有多个起点一个终点时,反向求最短路6.双端队列求01最短路什么是01最短路顾名思义,边权只有0和1的最短路。算法分析01最短路是最短路类型中比较特殊的一种,当然你也可以用一般的最短路解法(Dijkstra或SPFA),但总所周知利用BFS队列维护,时间复杂度往往只需要O(N)。那该如何实现呢?如果当前处理的点连接的边为0,那么将这个点移至原创 2021-08-07 10:49:01 · 132 阅读 · 0 评论 -
H - Hellcife is on fire Gym - 102448H
题目链接题目描述:The kingdom of Hellcife has several cities that are connected by some roads. One day, the king of Hellcife, Bair Jolsonaro, decided to set fire on some of these cities, just for fun. It’s known that the i-th city has a number Ti, indicating that原创 2021-02-21 16:30:57 · 102 阅读 · 0 评论 -
回家之旅
#include <iostream>#include <bits/stdc++.h>#include <string.h>#include <set>#include <list>#include <map>#include <algorithm>#include <stdio.h>#include <math.h>#include <bitset>#include原创 2021-01-19 16:38:41 · 321 阅读 · 0 评论 -
迪杰斯特拉+【堆(小根堆)】/【优先队列】和spfa算法的区别
大佬博客:https://www.cnblogs.com/flipped/p/6830073.html转载 2020-11-20 21:35:40 · 166 阅读 · 0 评论 -
【迪杰斯特拉的优化】 洛谷4779板子题
P4779 【模板】单源最短路径(标准版)题目背景2018 年 7 月 19 日,某位同学在 NOI Day 1 T1 归程 一题里非常熟练地使用了一个广为人知的算法求最短路。然后呢?最终,他因此没能与理想的大学达成契约。小 F 衷心祝愿大家不再重蹈覆辙。题目描述给定一个 n个点,m条有向边的带非负权图,请你计算从 s 出发,到每个点的距离。数据保证你能从 sss 出发到任意点。输入格式第一行为三个正整数 n,m,s。 第二行起 m行,每行三个非负整数 ui,vi,wi,表示从 ui原创 2020-11-20 20:41:11 · 329 阅读 · 0 评论