上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 47 下一页

2014年4月16日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1281同行同列最多只能放一辆车,所以可以看做二分图。把x坐标和y坐标分别看做二分图的两边点集,把二分图的边看做放车,所以放最多的车就是求二分图的最大匹配。从头删边,如果删掉以后的最大匹配小于原最大匹配,该边就构成重... 阅读全文
posted @ 2014-04-16 16:33 LegendaryAC 阅读(404) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4068暴力枚举两个全排列,犯了若干错误,以此为鉴#include #include #include #include using namespace std ;int n,f,m[10],vis[10],vis2... 阅读全文
posted @ 2014-04-16 00:02 LegendaryAC 阅读(180) 评论(0) 推荐(0) 编辑

2014年4月15日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1068应用匈牙利算法第三个扩展,求二分图的最大独立集,但由于路径是双向的,所以求出的最大匹配是实际最大匹配数*2,还要再除回去才行,单向路径就没有这个问题#include #include #include usi... 阅读全文
posted @ 2014-04-15 16:18 LegendaryAC 阅读(174) 评论(0) 推荐(0) 编辑

2014年4月10日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2444判断是否构成二分图,如果有则求最大匹配二分图判断用染色法,一个dfs就出来,具体看代码#include #include using namespace std ;int n,m ;struct node{ ... 阅读全文
posted @ 2014-04-10 17:37 LegendaryAC 阅读(109) 评论(0) 推荐(0) 编辑

2014年4月9日

摘要: 二分图最大匹配邻接表:O(nm)struct node{ int s,t,nxt ; }e[1005] ;int k,m,n,head[505],cnt,match[505],vis[505] ;int find(int s){ for(int i=head[s] ;i!=-1 ;i=e... 阅读全文
posted @ 2014-04-09 10:52 LegendaryAC 阅读(269) 评论(0) 推荐(0) 编辑

2014年4月8日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3631只能走标记过的点,方法是标记哪个点就对哪个点做floyd#include #include #include using namespace std ;const int INF=0xfffffff ;int... 阅读全文
posted @ 2014-04-08 15:47 LegendaryAC 阅读(202) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1198裸并查集,主要工作在根据题目给出关系构图#include #include #include using namespace std ;int idx[2505] ;int m,n ;char M[55][5... 阅读全文
posted @ 2014-04-08 15:44 LegendaryAC 阅读(124) 评论(0) 推荐(0) 编辑

2014年4月7日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4034给出最短路,问最少有几条边,floyd加一个变量记录该边是否取如果满足dis[i][k]+dis[k][j]==dis[i][j],那么i到j这条边就不取如果出现dis[i][k]+dis[k][j]#inc... 阅读全文
posted @ 2014-04-07 23:17 LegendaryAC 阅读(228) 评论(0) 推荐(0) 编辑

2014年4月6日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2807把矩阵相乘放在第二重循环,第三重循环只进行比较可以水过,优化的方法不懂主要用这题练习floyd的写法#include #include using namespace std ;const int INF=0... 阅读全文
posted @ 2014-04-06 02:38 LegendaryAC 阅读(258) 评论(0) 推荐(0) 编辑

2014年4月4日

摘要: http://zh.wikipedia.org/wiki/%E6%96%AF%E7%89%B9%E7%81%B5%E6%95%B0第一类:n个元素分成k个非空循环排列(环)的方法总数递推式:s(n+1,k)=s(n,k-1)+n*s(n,k)解释:考虑第n+1个元素 1、单独形成循环排列,剩下的有s(n,k-1)种方法 2、和别的元素一起形成循环排列,n个元素形成循环排列的方法数是s(n,k),第n+1个可以放在第i个元 素左边,共有n种放法,一共是n*s(n,k)代码:memset(str1,0,sizeof(str1)) ;for(int i=1 ;i<=20 ;i++){ st.. 阅读全文
posted @ 2014-04-04 17:05 LegendaryAC 阅读(448) 评论(0) 推荐(0) 编辑
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 47 下一页