Problem G. Variance-MST
时间限制 3000 ms
内存限制 256 MB
Given a edge-weighted graph, your task is to compute the spanning tree with the smallest variance.
Formally, if $w_{e}$ denotes the weight of edge $e$ then the variance of the tree with $n$ vertices is
$\frac{\sum\limits_{e}(w_e - A)^{2}}{n - 1}$, where $A = \sum\limits_{e}\frac{w_e}{n - 1}$
输入数据
输出数据
Let $P / Q$ be the number of correct answers, represented as an irreducible fraction. Print $PQ^{-1}$ modulo 998244353.
each test case one line.
样例输入
复制
1
4 6
1 2 2
1 3 4
2 3 6
4 1 7
4 2 5
4 3 3
样例输出
$ Mathjax font initiator $