
BFS
文章平均质量分 92
做不完的ACM
加油,努力
展开
-
CF920E 补图的联通块数
题目链接:http://codeforces.com/contest/920/problem/E题解:首先2个集合s1,s2,一个用来存当前点,一个用来临时保存。把删除的边存图,设当前访问的点为S点,集合s1里有点,如果S的出边的点(即u,v之间要删边)在s1里,就需要删除,临时存在s2里,然后访问集合s1,这时集合s1剩下的点一定与S在一个块里面,这次的联通快++,然后入队列,当然之前删除的原创 2018-02-03 15:45:24 · 547 阅读 · 0 评论 -
HDU5876
补图最短路:#include using namespace std;#define SZ(X) ((int)X.size())#define pb push_back#define RALL(X) X.rbegin(),X.rend()#define ALL(X) X.begin(),X.end()#define lson l,mid,rt#defin原创 2018-02-03 16:27:23 · 223 阅读 · 0 评论 -
牛客练习赛14D bitset最短路
链接:https://www.nowcoder.com/acm/contest/82/E来源:牛客网题目描述 有一个n个点的无向图,有m次查询,每次查询给出一些(xi,yi) 令dist(x,y)表示x和y点在图中最短距离,dist(x,x)=0,如果x,y不连通则dist(x,y) = inf 每次查询图中有多少个点v与至少一个这次询问给出的(xi,yi)满足dist(v,xi...原创 2018-04-01 18:51:11 · 177 阅读 · 0 评论 -
第十四届华中科技大学程序设计竞赛 J BFS
链接:https://www.nowcoder.com/acm/contest/106/J来源:牛客网It’s universally acknowledged that there’re innumerable trees in the campus of HUST. And there are many different types of trees in HUST, each o...原创 2018-04-30 20:00:25 · 201 阅读 · 0 评论 -
第十四届华中科技大学程序设计竞赛-L—Fresh Air,bfs拓展,倒着bfs
链接:https://www.nowcoder.com/acm/contest/106/L来源:牛客网It’s universally acknowledged that there’re innumerable trees in the campus of HUST. And you know that, trees have the special ability to ...原创 2018-05-06 17:22:08 · 252 阅读 · 0 评论