随笔分类 -  BFS

摘要:#include<algorithm> #include<iostream> #include<cstdlib> #include<cstring> #include<cstdio> #include<cmath> #include<queue> using namespace std; typed 阅读全文
posted @ 2016-07-23 19:52 Yangjiyuan 阅读(186) 评论(0) 推荐(0)
摘要:两次bfs可得直径,答案一定不会小于所有点到直径的距离最大值,只要把直径上的边权设为0,任选直径上一点bfs可得将最大值作为二分下界,二分直径左右端点的舍弃部分 阅读全文
posted @ 2016-07-23 19:45 Yangjiyuan 阅读(201) 评论(0) 推荐(0)
摘要:#include #include #include #include #include #include #include using namespace std; int xx[5]={0,0,1,-1}, yy[5]={1,-1,0,0}; int bg,ed,h,x,y; int t,w=1; bool ans[5][5],mark[100010]; ... 阅读全文
posted @ 2016-05-31 19:29 Yangjiyuan 阅读(139) 评论(0) 推荐(0)