
树的直径
xuanweiace
一个热爱算法竞赛的弱校ACMer路过。青大本,浙大硕,方向后端开发,菜鸡一枚,奋斗ing...
展开
-
【POJ - 2631 】Roads in the North(树的直径)
题干:Building and maintaining roads among communities in the far North is an expensive business. With this in mind, the roads are build such that there is only one route from a village to a village th...原创 2018-07-30 22:05:11 · 368 阅读 · 0 评论 -
【POJ - 3310】Caterpillar(并查集判树+树的直径求树脊椎(bfs记录路径)+dfs判支链)
题干:An undirected graph is called a caterpillar if it is connected, has no cycles, and there is a path in the graph where every node is either on this path or a neighbor of a node on the path. This p...原创 2018-08-02 15:32:16 · 491 阅读 · 0 评论 -
【POJ - 2631】Roads in the North (树的直径,模板)
题干:Building and maintaining roads among communities in the far North is an expensive business. With this in mind, the roads are build such that there is only one route from a village to a village th...原创 2018-09-15 17:56:51 · 270 阅读 · 0 评论 -
【牛客 - 181D】小叶的巡查(树的直径,数学)
题干:8102年,牛客系列竞赛空前繁荣。为了更好地管理竞赛,小叶决定巡查于各大城市之间,体察民情。所以,从一个城市马不停蹄地到另一个城市成了小叶最常做的事情。小叶有一个钱袋,用于存放往来城市间的路费。这个国家有一套优秀的交通方案,使得任何一个大城市都能从首都直接或者通过其他大城市间接到达。同时,如果不重复经过大城市,从首都到达每个大城市的方案都是唯一的。如果不在某个城市停下来修整,在连...原创 2018-10-10 21:24:34 · 302 阅读 · 0 评论 -
【牛客 - 369C】小A与欧拉路(bfs树的直径)
题干:链接:https://ac.nowcoder.com/acm/contest/369/C来源:牛客网小A给你了一棵树,对于这棵树上的每一条边,你都可以将它复制任意(可以为0)次(即在这条边连接的两个点之间再加一条边权相同的边),求所有可能新形成的图中欧拉路的最短长度欧拉路:从图中任意一个点开始到图中任意一个点结束的路径,并且图中每条边只通过恰好一次输入描述:第一行...原创 2019-03-03 16:05:07 · 334 阅读 · 0 评论 -
【牛客 - 188C】水图(bfs树的直径,思维)
题干:链接:https://ac.nowcoder.com/acm/contest/188/C来源:牛客网小w不会离散数学,所以她van的图论游戏是送分的小w有一张n个点n-1条边的无向联通图,每个点编号为1~n,每条边都有一个长度小w现在在点x上她想知道从点x出发经过每个点至少一次,最少需要走多少路输入描述:第一行两个整数 n,x,代表点数,和小w所处的位置第二...原创 2019-03-03 16:07:12 · 379 阅读 · 0 评论 -
【HDU - 5886】Tower Defence(树的直径,思维,dp)
题干:There was a civil war between two factions in Skyrim, a province of the Empire on the continent of Tamriel. The Stormcloaks, led by Ulfric Stormcloak, are made up of Skyrim's native Nord race. Th...原创 2019-07-26 20:30:45 · 330 阅读 · 0 评论