CF618D Hamiltonian Spanning Tree
题目描述
n 个城市之间形成了一个有n*(n-1)/2条边的完全无向图。走每条边需要y秒。
给定该图的一个n-1条边的生成树,走树上的每一条边只需要x秒(不过注意x不一定小于y)。
你希望从任意一个点开始,经过每个点恰好一次,在任意一个点结束的路径的长度所花时间最少。求最少时间。
输入格式
第一行包含三个整数 n,x,y
接下来 n−1行每行包含两个整数a和b,表示生成树上a与 b之间有一条边。保证这些边形成一棵生成树。
输出格式
输出一个整数,表示环游城市最小时间。
说明/提示
In the first sample, roads of the spanning tree have cost $ 2 $ , while other roads have cost $ 3 $ . One example of an optimal path is .
In the second sample, we have the same spanning tree, but roads in the spanning tree cost 3, while other roads cost 2. One example of an optimal path is .