1647.
I Curse Myself
时间限制 4000 ms
内存限制 128 MB
There is a connected undirected graph with weights on its edges. It is guaranteed that each edge appears in at most one simple cycle.
Assuming that the weight of a weighted spanning tree is the sum of weights on its edges, define $V(k)$ as the weight of the $k$-th smallest weighted spanning tree of this graph, however, $V(k)$ would be defined as zero if there did not exist $k$ different weighted spanning trees.
Please calculate $\displaystyle\left(\sum_{k=1}^{K}{k \cdot V(k)}\right) \bmod 2^{32}$.
输入数据
输出数据
For each test case, output "Case #$x$: $y$" in one line (without quotes), where $x$ indicates the case number starting from $1$ and $y$ denotes the answer of corresponding case.
样例输入
复制
4 3
1 2 1
1 3 2
1 4 3
1
3 3
1 2 1
2 3 2
3 1 3
4
6 7
1 2 4
1 3 2
3 5 7
1 5 3
2 4 1
2 6 2
6 4 5
7
· \n
· · \n
· · \n
· · \n
\n
· \n
· · \n
· · \n
· · \n
\n
· \n
· · \n
· · \n
· · \n
· · \n
· · \n
· · \n
· · \n
\n
样例输出
复制
Case #1: 6
Case #2: 26
Case #3: 493
· · \n
· · \n
· · \n