CF1332F.Independent Set
省选/NOI-
通过率:0%
时间限制:2.00s
内存限制:512MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Eric is the teacher of graph theory class. Today, Eric teaches independent set and edge-induced subgraph.
Given a graph G=(V,E), an independent set is a subset of vertices V′⊂V such that for every pair u,v∈V′, (u,v)∈E (i.e. no edge in E connects two vertices from V′).
An edge-induced subgraph consists of a subset of edges E′⊂E and all the vertices in the original graph that are incident on at least one edge in the subgraph.
Given E′⊂E, denote G[E′] the edge-induced subgraph such that E′ is the edge set of the subgraph. Here is an illustration of those definitions:

In order to help his students get familiar with those definitions, he leaves the following problem as an exercise:
Given a tree G=(V,E), calculate the sum of w(H) over all except null edge-induced subgraph H of G, where w(H) is the number of independent sets in H. Formally, calculate ∅=E′⊂E∑w(G[E′]).
Show Eric that you are smarter than his students by providing the correct answer as quickly as possible. Note that the answer might be large, you should output the answer modulo 998,244,353.
Eric 是图论课的老师。今天,Eric 讲授了独立集(independent set)与边导出子图(edge-induced subgraph)的概念。
给定一个图 G=(V,E),一个独立集是指顶点集的一个子集 V′⊂V,使得对任意 u,v∈V′,均有 (u,v)∈E(即 E 中不存在连接 V′ 中两个顶点的边)。
一个边导出子图由边集的一个子集 E′⊂E 以及原图中至少与 E′ 中某条边相关联的所有顶点构成。
对任意 E′⊂E,记 G[E′] 为以 E′ 为边集的边导出子图。以下是这些定义的示意图:

为了帮助学生熟悉这些概念,Eric 留下了如下练习题:
给定一棵树 G=(V,E),计算 G 的所有非空边导出子图 H 的权值 w(H) 之和,其中 w(H) 表示 H 中独立集的个数。形式化地,需计算
∅=E′⊂E∑w(G[E′]).
向 Eric 证明你比他的学生更聪明,请尽快给出正确答案。注意答案可能很大,你应输出答案对 998244353 取模的结果。
输入格式
The first line contains a single integer n (2≤n≤3⋅105), representing the number of vertices of the graph G.
Each of the following n−1 lines contains two integers u and v (1≤u,v≤n, u=v), describing edges of the given tree.
It is guaranteed that the given edges form a tree.
第一行包含一个整数 n(2≤n≤3⋅105),表示图 G 的顶点数。
接下来的 n−1 行每行包含两个整数 u 和 v(1≤u,v≤n,且 u=v),描述给定树的边。
保证所给的边构成一棵树。
输出格式
Output one integer, representing the desired value modulo 998,244,353.
输出一个整数,表示所求值对 998,244,353 取模的结果。
输入输出样例
输入#1
2 2 1
输出#1
3
输入#2
3 1 2 3 2
输出#2
11
说明/提示
For the second example, all independent sets are listed below.

对于第二个例子,所有独立集如下所示。

输入解题思路,AI测评打分。不知道怎么写?