
图论
Spark_007
Forward.
展开
-
Hdu 1325 Is It ATree? -- 树形 (并查集,入度出度)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1325题意:给一些有向边,判断是否是一棵树分析:1>将边看成无向边,用并查集判断是否成树形,边数==点数-1。2>根据有向边记录每个结点的出入度,有向树里只有1个入度为0的点。 #include #include const int MAX = 1005;int ind[原创 2013-09-30 11:03:35 · 752 阅读 · 0 评论 -
POJ 1741 Tree + POJ 1987 Distance Statistics【树的点分治】
Tree Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 13558 Accepted: 4367 DescriptionGive a tree with n vertices,each edge has a length(positive integer less than 1001). Def原创 2015-08-03 23:40:44 · 801 阅读 · 0 评论