8561: Forest

内存限制:512 MB 时间限制:5 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:2 通过:1

题目描述

Given a weighted undirected simple graph with n vertices and mmm positive-weighted edges. Sum up the weight of the minimum spanning forest for each of its spanning subgraph, and print the value modulo 998244353 as answer.

minimum spanning forest of a weighted undirected graph with vertex set V and edge set E is defined as follows:
  • It's a subset of E (not necessarily non-empty or different from E), denoted as S.
  • Any pair of vertices (u,v) which can reach each other in G can still reach each other only using edges in S.
  • S is the subset with minumum weight among all subsets satisfying the above two conditions. The weight of S is the sum of weight of all edges in it.

spanning subgraph of G is a graph with vertex set V and edge set a subset of E (not necessarily non-empty or different from E).

输入格式

输出格式

Print a single integer in the first line, which is the value modulo 998244353.

输入样例 复制

4
0 1 1 1
1 0 1 1
1 1 0 1
1 1 1 0

输出样例 复制

158

分类标签