随笔分类 -  二分匹配

上一页 1 2

图论部分,最大匹配
POJ 3020 Antenna Placement(二分图匹配)
摘要:Antenna PlacementTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 4739Accepted: 2359DescriptionThe Global Aerial Research Centre has been allotted the task of building the fifth generation of mobile phone nets in Sweden. The most striking reason why they got the job, is their discovery of a 阅读全文

posted @ 2012-08-19 00:41 kuangbin 阅读(498) 评论(0) 推荐(0) 编辑

POJ 3041 Asteroids(二分匹配模板题)
摘要:AsteroidsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 10288Accepted: 5556DescriptionBessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 <= N <= 500). The grid contains K asteroids (1 <= K <= 10,000), which are convenientl 阅读全文

posted @ 2012-08-18 23:30 kuangbin 阅读(545) 评论(0) 推荐(0) 编辑

HDU 4185 Oil Skimming(二分匹配,匈牙利算法)
摘要:Oil SkimmingTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 87Accepted Submission(s): 50Problem DescriptionThanks to a certain "green" resources company, there is a new profitable industry of oil skimming. There are large slicks of crude 阅读全文

posted @ 2012-04-22 18:41 kuangbin 阅读(1248) 评论(0) 推荐(0) 编辑

二分图匹配(Hopcroft-Carp的算法)模版:
摘要:/**********************************************二分图匹配(Hopcroft-Carp的算法)。初始化:g[][]邻接矩阵调用:res=MaxMatch(); Nx,Ny要初始化!!!时间复杂大为 O(V^0.5 E)适用于数据较大的二分匹配 ***********************************************/ const int MAXN=3001;const int INF=1<<28;int g[MAXN][MAXN],Mx[MAXN],My[MAXN],Nx,Ny;int dx[MAXN],dy[MA 阅读全文

posted @ 2011-08-12 11:19 kuangbin 阅读(1923) 评论(0) 推荐(0) 编辑

ACM HDU 2389 Rain on your Parade(二分匹配 Hopcroft-Carp的算法)
摘要:Rain on your ParadeTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 655350/165535 K (Java/Others)Total Submission(s): 1310Accepted Submission(s): 373Problem DescriptionYou’re giving a party in the garden of your villa by the sea. The party is a huge success, and everyone is here. It’s a warm, sun 阅读全文

posted @ 2011-08-12 11:18 kuangbin 阅读(801) 评论(0) 推荐(0) 编辑

ACM HDU 2819 Swap (二分图匹配,记录过程)
摘要:SwapTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 459Accepted Submission(s): 129Special JudgeProblem DescriptionGiven an N*N matrix with each entry equal to 0 or 1. You can swap any two rows or any two columns. Can you find a way to make all the 阅读全文

posted @ 2011-08-11 14:47 kuangbin 阅读(1191) 评论(0) 推荐(1) 编辑

ACM HDU 1281 棋盘游戏 (二分匹配,方格的建图,找关键点)
摘要:棋盘游戏Time Limit : 2000/1000ms (Java/Other)Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 5Accepted Submission(s) : 4Font: Times New Roman | Verdana | GeorgiaFont Size: ← →Problem Description小希和Gardon在玩一个游戏:对一个N*M的棋盘,在格子里放尽量多的一些国际象棋里面的“车”,并且使得他们不能互相攻击,这当然很简单,但是Gardon限制了只有某些格子才可以放,小希还是很轻 阅读全文

posted @ 2011-08-10 22:16 kuangbin 阅读(894) 评论(0) 推荐(0) 编辑

ACM HDU 1083 Courses(二分匹配,最大匹配)
摘要:题目大意:有p个课程和n个学生,每个学生可以自由选择课程(0到p个),现在要建立一个委员会,问是否能找到每个课程都有学生代表的集合,一个学生只能代表一个课程题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1083简单的二分匹配,用匈牙利算法就可以,主要是练习模板,固定方法解题!程序:#include<stdio.h>#include<iostream>using namespace std;#define MAXN 305int g[MAXN][MAXN];int uN,vN;int linker[MAXN];bool us 阅读全文

posted @ 2011-08-10 20:57 kuangbin 阅读(728) 评论(0) 推荐(0) 编辑

ACM HDU 2444 The Accomodation of Students(判断是否为二部图,然后求最大匹配)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2444题意: 有n个学生,有m对人是认识的,每一对认识的人能分到一间房,问能否把n个学生分成两部分,每部分内的学生互不认识,而两部分之间的学生认识。如果可以分成两部分,就算出房间最多需要多少间,否则就输出No。分析:先是要判断是否为二部图,然后求最大匹配。这里的程序hungary()用vector实现/*HDU 2444 The Accomodation of Students*/#include<iostream>#include<string.h>#include< 阅读全文

posted @ 2011-08-10 16:51 kuangbin 阅读(719) 评论(0) 推荐(1) 编辑

HDU 1045 Fire Net(建模,用二分匹配)
摘要:Fire NetTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2349Accepted Submission(s): 1342Problem DescriptionSuppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a st 阅读全文

posted @ 2011-08-09 21:34 kuangbin 阅读(3320) 评论(0) 推荐(0) 编辑

二分图匹配(匈牙利算法模板)
摘要:一、最大匹配——匈牙利算法/****************************************************二分图匹配(匈牙利算法的DFS实现)INIT:g[][]两边定点划分的情况CALL:res=hungary();输出最大匹配数优点:适于稠密图,DFS找增广路快,实现简洁易于理解时间复杂度:O(VE);****************************************************/const int MAXN=1000;int uN,vN; //u,v数目int g[MAXN][MAXN];//编号是0~n-1的 int linker[M 阅读全文

posted @ 2011-08-09 21:32 kuangbin 阅读(5382) 评论(5) 推荐(2) 编辑

上一页 1 2

导航

JAVASCRIPT: