图论-树
-skyline-
这个作者很懒,什么都没留下…
展开
-
POJ 1655 树的重心 DFS
#include<iostream> #include<cstring> #include<cstdio> using namespace std; const int N=20005,M=N<<1; int e[M],ne[M],h[N],idx; bool st[N]; int ans=N,node,n; void add(int a,int ...原创 2019-07-30 20:42:36 · 107 阅读 · 0 评论 -
Godfather POJ - 3107 树的重心
题目要求输出给出树的所有重心。 有个结论:一棵有根树至多有两个重心。 #include<iostream> #include<cstring> using namespace std; const int N=50005,M=N<<1; int h[N],e[M],ne[M],idx; bool st[N]; void add(int a,int b){ ...原创 2019-07-30 21:28:20 · 115 阅读 · 0 评论