摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1526思路:floyd求传递闭包,然后就是最大匹配了,不过一开始输入没看清,被坑了将近2个小时。 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 #include<vector> 6 using namespace std; 7 #define MAXN 111 8 vector<int>vet[MAXN]; 阅读全文
posted @ 2013-06-18 04:56 ihge2k 阅读(265) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1669思路:由于要求minimize the size of the largest group,由此我们想到二分枚举,然后每一次求一下多重匹配就可以了。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define MAXN 1010 8 #define MAXM 555 9 vectorvet[MAXN];10 bool map[MAXN][MAXN];11 int Link[MAX 阅读全文
posted @ 2013-06-18 02:55 ihge2k 阅读(307) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2389思路:纯裸的一个最大匹配题,不过悲摧的是以前一直用的dfs版一直过不了,TLE无数次啊,然后改成bfs就过了。 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 #include<vector> 6 #include<cmath> 7 #include<queue> 8 using namesp 阅读全文
posted @ 2013-06-18 01:51 ihge2k 阅读(268) 评论(0) 推荐(1) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3118思路:题目要求是去掉最少的边使得图中不存在路径长度为奇数的环,这个问题等价于在图中去掉若干条边,使得这个图成为二分图。注意到n不是很大,于是我们可以想到二进制枚举,枚举每条边的两个顶点是否在同一个集合中,若是,则删除这条边。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define inf 1 >map; 9 int n,m;10 11 int main()12 {13 阅读全文
posted @ 2013-06-18 00:51 ihge2k 阅读(619) 评论(0) 推荐(0) 编辑