随笔分类 -  图论——二分图匹配

摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4619 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #define maxn 1001 9 #define N 10510 using namespace std;11 12 int map[N][N];13 bool G[maxn][maxn];14 int n,m;15 int ans;16 bool vis[maxn];17 int link[maxn];18 in... 阅读全文
posted @ 2013-07-26 00:23 等待最好的两个人 阅读(236) 评论(0) 推荐(0)
摘要:本题最主要的就是拆点G[maxn][maxn],前面的是原来的点u,后面的是相对的u',如果接完客人u可以再去接客人v,则连G[u][v] = true; 然后就KM下,用n-m(匹配数)就是答案;#include#include#include#includeusing namespace std;const int maxn = 505;int n,T,ans;struct guest{ int sx,sy; int tx,ty; int st; int time;}gu[maxn];bool G[maxn][maxn];int link[maxn];int vis[maxn];b 阅读全文
posted @ 2013-05-21 19:53 等待最好的两个人 阅读(147) 评论(0) 推荐(0)
摘要:#include#include#include#includeusing namespace std;const int maxn = 505;struct student{ int height; char gender; char m[105]; char s[105];}stu[maxn];bool G[maxn][maxn];int n,ans;int link[maxn];int vis[maxn];void init(){ memset(link,-1,sizeof(link)); memset(G,0,sizeof(G));}bool dfs... 阅读全文
posted @ 2013-05-20 16:44 等待最好的两个人 阅读(187) 评论(0) 推荐(0)