随笔分类 -  图论 最短路

摘要:先附上测试数据8 125 8 296 1 128 3 111 2 43 1 224 3 177 4 25 6 5 98 7 71 6 93 2 196 7 48个点12条边#include<stdio.h>#include<string.h>#include<queue>#include<algorithm>using namespace std;#define xx 10005int t,pre[xx];//边标号,表头;struct node{ int st,nd,ln,next;//起点,终点,长度,下一条边;}edge[xx];void 阅读全文
posted @ 2012-08-10 10:50 M_cag 阅读(1880) 评论(0) 推荐(0)
摘要:spfa的模板,但是,是用邻接表存边的,但是邻接表神物,不懂邻接表的可以去看我的邻接表随笔 1 #include<stdio.h> 2 #include<string.h> 3 #include<queue> 4 #include<algorithm> 5 using namespace std; 6 #define xx 10005 7 #define INF 0x2fffffff 8 queue<int>que; 9 int t,pre[xx];//边标号,表头;10 int dis[xx],inque[xx];11 struct 阅读全文
posted @ 2012-08-09 21:18 M_cag 阅读(162) 评论(0) 推荐(0)