![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
BFS
文章平均质量分 75
leolin_
这个作者很懒,什么都没留下…
展开
-
hdu 1241 bfs or dfs
http://acm.hdu.edu.cn/showproblem.php?pid=1241基本没什么做过bfs,所以尝试做做,看了一个课件后才基本明白bfs原理附上课件网址:http://wenku.baidu.com/view/3cc5ea6c58fafab069dc02d8.html//================================================ //hdu 1241 bfs //1241 15MS 248K 893 B C++ //============原创 2011-04-29 17:04:00 · 1186 阅读 · 0 评论 -
hdu 2444 判断是否构成二分图,并求最大匹配
关于二分匹配详见http://blog.csdn.net/leolin_/archive/2011/05/04/6393259.aspx//构造的二分图虽然是多解的,但是任意一个二分图的最大匹配数相等 #include using namespace std; #include #include #define MAX 210 bool map[MAX][MAX]; int vis[MAX]; int match[MAX]; int n; struct node { int n原创 2011-05-04 21:55:00 · 740 阅读 · 0 评论 -
UVa 3721 - Islands 【bfs】
http://livearchive.onlinejudge.org/index.php?option=com_onlinejudge&page=show_problem&problem=1722很脑残的bfs,注意找水的时候不要标记!#include #include #inc原创 2011-07-13 22:30:44 · 419 阅读 · 0 评论 -
【BFS】ural 1837
贡献了一次CE!timus竟然不认! #include #include #include #include #include #include #include #include #include #include #include #include原创 2011-08-22 00:12:21 · 630 阅读 · 0 评论 -
【BFS】ural 1033
BFS,不解释。注意要从两个入口开始找! #include #include #include #include #include #include #include #include #include #include #include #include原创 2011-08-22 01:18:25 · 447 阅读 · 0 评论 -
【bfs优先队列】POJ 3635
http://poj.org/problem?id=3635 #define N 1005 struct node{ int u; int len; }; vector v[N]; int n,m; int price[N]; void add(int a,int b,int w){ node tmp; tmp.u = b; tmp.len = w;原创 2012-03-06 12:15:41 · 527 阅读 · 0 评论 -
【bfs优先队列/floodfill】POJ 2227
刘汝佳黑书P89例题,先把边界入队,取出最小的检查4个方向,如果小于当前的证明可以注水,注水完后更新高度为当前高度,入队;如果大于当前高度就直接入队。。。所以出队的元素都是不能注水的....黑书上说有floodfill算法,没研究过,应该类似这样吧 LL ans; struct node{ int x,y; int h; friend bool operator < (n原创 2012-03-06 21:56:59 · 1198 阅读 · 0 评论 -
【bfs优先队列】POJ 2312
char g[333][333]; int n,m; struct node{ int x,y; int step; friend bool operator <(node a,node b){ return a.step>b.step; } }; node st,end; bool vis[333][333]; int d[4][2] = {0,1原创 2012-03-06 13:07:41 · 484 阅读 · 0 评论