AT_AGC_A (最新)English
2026-07-10 21:12:19
发布于:广东
和正式题目略有不同,可忽略不计
AT_AGC_A - Min Cut of Graph of Min Weight
Score: 900 points
Problems Statement
There is a weighted tree with vertices numbered 1 to .The i-th edge of T connects vertices and with weight .
We now construct a complete indirected gragh with vertices numbered 1 to , based on . For each edge of , the capacity is defined as follows.
The capacity of edge
(i,j) of is the minimum weight of an edge contained in the path connecting vertices i and j on .
Let f(i,j) be the capacity of the minimumcut separating vertices i and j on .
Find ·(i,j) , modulo 998244353.
Solve cases for each input.
Constraints
- 1 ≤ ≤ 125000
- 2 ≤ ≤ 250000
- 1 ≤ , ≤N
- 1 ≤ ≤
- The input graph is a tree.
- The sum of over the cases is at most 250000.
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Each test case is given in the following format:
Output
For each test case, output the answer.
Sample Input 1
4
3
1 2 1
2 3 10
4
1 2 1
2 3 10
3 4 2
13
11 4 337329830
13 1 72247
4 1 1768959
5 4 5399893
2 8 1832265
12 7 107755
10 4 743
5 12 95
4 3 389684075
2 6 1222
11 8 253280162722
9 4 21671
15
8 5 285187324995
14 10 755031423304
2 8 88860861719
12 7 596982637940
10 4 225447687713
7 15 210989590191
13 5 836365489027
6 15 859904883890
8 1 362117197524
12 8 422952343663
1 14 112179584332
15 11 487330735107
12 9 528451854379
3 7 343910842803
Sample Output 1
15
32
13620068
909241492
Explanation
In the first test case, the capacities of edges (1,2)$, , and $(2,3) of are , , and , respectively. The answer is:
全部评论 2
?我直接看正式题不好吗
2天前 来自 浙江
06
2天前 来自 广东
0
和正式题目略有不同,可忽略不计
2天前 来自 广东
0



















有帮助,赞一个