BFS
文章平均质量分 83
西风丶
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
(并查集 or BFS+二分)HDU5652
点击打开链接 并查集: #include #define N 505 using namespace std; struct node { int x,y; }; char map[N][N]; node p[N*N]; int turnx[4]={0,0,-1,1}; int turny[4]={-1,1,0,0}; int father[N*N]; int ra原创 2016-05-16 20:47:22 · 405 阅读 · 0 评论 -
(BFS)codeforces #Round354-div2-D
题目链接:题目链接 题意:一个n*m的区域,每个格子都有上下左右四个门,相邻的两个格子A可以通向B当且仅当A对B的门和B对A的门都打开,问从起点S到终点T需要的最短时间 #include using namespace std; const int N=1003; int n,m; int sx,sy,tx,ty; int dirx[]={1,-1,0,0}; int diry原创 2016-05-31 00:22:58 · 337 阅读 · 0 评论 -
HDU5438--Ponds (拓排+BFS)
点击打开链接 题意:给定n个池塘,m对池塘相连,现在要将与少于2个池塘相连的池塘拆除,形成森林,求节点数为奇数的树权值之和 思路:按照拓排的思想不断删除度数小于2的节点 #include using namespace std; typedef long long ll; const int N=1e4+5; vector G[N]; queue Q;//拓排队列 que原创 2016-07-14 13:43:12 · 342 阅读 · 0 评论 -
HDU 5876 (大连网赛1009)(BFS + set)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5876 题意:给定一个图(n个顶点m条边),求其补图最短路 思路:集合a表示当前还未寻找到的点,集合b表示本次bfs之后仍未寻找到的点 #include #include #include #include using namespace std; const int N = 2e5 + 5; s原创 2016-09-14 15:31:59 · 290 阅读 · 0 评论
分享