摘要: 求最小生成树的长度最小的边,我用的是prim算法: 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int INF=0x3f3f3f3f; 7 int map[505][505]; 8 int visit[5... 阅读全文
posted @ 2015-05-15 20:08 dominjune 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 拓扑排序啦,就是像这样写的,邻接表好像挺好用的,不需要判断有无边,注意入度为0的一开始都放到队列里面;这题很坑的就是输入u v是指v->u而不是u->v,由题意!!! 1 #include 2 3 using namespace std; 4 5 vector graph[10005]; 6... 阅读全文
posted @ 2015-05-15 19:45 dominjune 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 深搜中与记录长度有关的题目,都差不多是这样的!还有邻接表的写法,不够熟! 1 #include 2 3 using namespace std; 4 5 int ans; 6 7 bool vis[10005]; 8 9 struct edge {10 int u;11 i... 阅读全文
posted @ 2015-05-15 00:21 dominjune 阅读(192) 评论(0) 推荐(0) 编辑