随笔分类 -  最短路

摘要:problemsolutioncodes#include#include#includeusing namespace std;int a[101],b[101];double f[101][101];int n,m,x,y,s,t;void floyd(){ ... 阅读全文
posted @ 2018-06-03 10:46 gwj1139177410 阅读(108) 评论(0) 推荐(0)
摘要:problemsolutioncodes//Floyd-wallshall模板#includeusing namespace std;int n, e[110][110];int main(){ ios::sync_with_stdio(false); c... 阅读全文
posted @ 2018-06-01 21:48 gwj1139177410 阅读(98) 评论(0) 推荐(0)
摘要:problemsolutioncodes//标程Dijkstra#include#include#includeusing namespace std;//Tint n = 60, m, vis[1010];//Graphstruct Edge{ int v, ... 阅读全文
posted @ 2018-06-01 21:32 gwj1139177410 阅读(112) 评论(0) 推荐(0)
摘要:problem给你一个n个点m条边的无向图,求 s 到 t 的最短路。solutionSPFA模板codes#include#include#include#define maxn 2500+10#define maxm 6200+10using namespace ... 阅读全文
posted @ 2018-06-01 13:28 gwj1139177410 阅读(206) 评论(0) 推荐(0)
摘要:Dijkstra给定一张有向/无向图,边权为非负整数,求s到所有点的最短路。初始时我们将s打上标记。对于每个未标记的点i,我们记f[i]表示s到i,,初始时为正无穷。只经过已标记的点的最短路。每次我们找到未标记的点中f最小的,将它打上标记并更新其余点的f值。时间复杂度... 阅读全文
posted @ 2018-05-29 12:17 gwj1139177410 阅读(119) 评论(0) 推荐(0)
摘要:problemsolutioncodes//标程Dijkstra#include#include#includeusing namespace std;//Tint n = 60, m, vis[1010];//Graphstruct Edge{ int v, ... 阅读全文
posted @ 2018-05-27 21:21 gwj1139177410 阅读(122) 评论(0) 推荐(0)
摘要:problemsolutioncodes//1.计算几何求第四点坐标, 方法很多//2.虚点,到A城市的四个机场边权都为0//3.SPFA跑最短路#include#include#include#include#include#includeusing namespa... 阅读全文
posted @ 2018-05-24 21:40 gwj1139177410 阅读(148) 评论(0) 推荐(0)
摘要:problem给出一个有向图求从某一点出发到所有点的最短路solutionSPFAcodes#include#include#include#define maxn 10010#define maxm 500010using namespace std;//Grape... 阅读全文
posted @ 2018-05-23 12:15 gwj1139177410 阅读(113) 评论(0) 推荐(0)

选择