摘要: http://poj.org/problem?id=3020最小路径覆盖,拆点,总结点数 = 匹配数*2+未匹配节点,所以所用天线数就等于匹配数+未匹配数=总结点-匹配数。由于拆点后,多加了边,匹配数变成了原来的2倍,有向图-》无向图,匹配数增加的是一样的。View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<cmath> 5 using namespace std; 6 int link[500],map[500][500],ma[50 阅读全文
posted @ 2013-01-18 21:10 _雨 阅读(165) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1422题意:一个镇上有很多街道,很多十字路口,无循环,把伞兵放在各个十字路口上,使之能把所有的街道都走过,求最小的伞兵数。最小路径覆盖=节点数-最大匹配。模板题View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 using namespace std; 5 int map[200][200],link[200],vis[200]; 6 int find(int x,int n) 7 { 8 int i,j; 9 阅读全文
posted @ 2013-01-18 18:49 _雨 阅读(187) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2226模板抄错,结果错了一下午。将连续横行上的*和连续纵桁上点分别看做两个点集,连接两集合中点的边就是图中的点。即求最小顶点覆盖最多的边。最小点覆盖=最大匹配。有篇图片的讲解,挺好,很形象。http://ip96cns.blog.163.com/blog/static/170095192201117465473/View Code 1 #include <iostream> 2 #include<cstdio> 3 #include<cstring> 4 using namespace std; 5 in 阅读全文
posted @ 2013-01-18 16:52 _雨 阅读(216) 评论(0) 推荐(0) 编辑