- 博客(7)
- 收藏
- 关注
原创 并查集的应用hdu1598
刚看到题,就想起最小生成树,但是没想到怎么去实现,第二天还是看了解题报告才想起枚举。#include#include#include#define maxn 205int pre[maxn];struct ss{ int beg; int end; int w;}s[1005];void init(int n){ for(int i=1;i<=
2012-08-15 10:00:21 391
原创 归并排序
首先我们来讨论归并算法,归并算法将一系列数据放到一个向量中,索引范围为[first,last],这个序列由两个排好序的子表构成,以索引终点(mid)为分界线,以下面一个序列为例 7,10,19,25,12,17,21,30,48 这样的一个序列中,分为两个子序列 7,10,19,25 和 12,17,21,30,48,如下图所示: 再使用归并算法的
2012-08-13 18:08:36 422
原创 hdu4339树状数组
http://acm.hdu.edu.cn/showproblem.php?pid=4339#include#include#includeusing namespace std;#define maxn 1000020int c[maxn],n;char s1[maxn],s2[maxn];int lowbit(int x){ return x&(-x);}voi
2012-08-04 11:03:13 376
原创 hdu棋盘游戏二分图
先求出原图的最大匹配t1,在一次枚举每个map【】【】为1的点,看是否小于t1,如果小于则是重要点;#include#include#define maxn 102int map[maxn][maxn];int use[maxn],path[maxn];bool dfs(int x,int m){ for(int i=1;i<=m;i++) { if
2012-08-02 15:24:45 779
原创 hdu2119二分图匹配
Problem DescriptionGive you a matrix(only contains 0 or 1),every time you can select a row or a column and delete all the '1' in this row or this column .Your task is to give out the minimum t
2012-08-02 09:21:42 801
原创 hdu4160二分图
http://acm.hdu.edu.cn/showproblem.php?pid=4160刚开始理解为贪心,结果题意弄错,用二分图解,一个娃娃至多装一个娃娃。#include#include#includestruct ac{ int x,y,z;}a[505];bool map[505][505];bool visit[505];int path[505];in
2012-08-01 15:01:38 923
原创 hdu2444二分图判断+最大匹配
题目大意就是:有n个学生,分成两队,每对中没有相互认识的,否则输出no,如果可以再用最大匹配。http://acm.hdu.edu.cn/showproblem.php?pid=2444#include#include#includeusing namespace std;#define maxn 220int map[maxn][maxn],use[maxn],path
2012-08-01 09:55:21 1225 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人