CF618D Hamiltonian Spanning Tree

题目描述

$n$ 个城市之间形成了一个有 $\frac{n(n-1)}{2}$ 条边的完全无向图。走每条边需要 $y$ 秒。 给定该图的一个 $n-1$ 条边的生成树,走树上的每一条边只需要 $x$ 秒(不过注意 $x$ 不一定小于 $y$)。 你希望从任意一个点开始,经过每个点恰好一次,在任意一个点结束的路径的长度所花时间最少。求最少时间。

输入格式

第一行包含三个整数 $n,x,y$($2\le n\le 200000,1\le x,y\le 10^9$)。 接下来 $n−1$ 行每行包含两个整数 $a$ 和 $b$($1\le a,b\le n$),表示生成树上 $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 ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF618D/fd268aca39dc90ab942d5fab2a7a973aad83077f.png). 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 ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF618D/fadc5e503a235380faa309138f414501c6fe529a.png).