AtCoder Beginner Contest 447
E
划分图
Divide Graph
AtCoder
⌀ 955
原题
← DF →

划分图AI (CI翻译)

Problem Statement

题目描述

AI (CI翻译)

You are given a simple connected undirected graph $G$ with $N$ vertices and $M$ edges. Here, $N \geq 2$. The vertices are numbered $1$ to $N$, and the edges are numbered $1$ to $M$; edge $i$ connects vertices $U_i$ and $V_i$. Each edge has a value called a cost, and the cost of edge $i$ is $2^i$.

给定一个有 $N$ 个顶点、$M$ 条边的简单连通无向图 $G$。其中,$N \geq 2$。顶点编号为 $1$ 到 $N$,边编号为 $1$ 到 $M$;边 $i$ 连接顶点 $U_i$ 和 $V_i$。每条边都有一个称为代价的值,边 $i$ 的代价为 $2^i$。AI (CI翻译)

You will now choose some edges of $G$ to delete so that the number of connected components of $G$ becomes exactly $2$. (It can be proved that this is always achievable under the constraints of this problem.)

现在,你要选择删除 $G$ 中的一些边,使图的连通分量数恰好变为 $2$。(可以证明,在本题的约束条件下,这总是可行的。)AI (CI翻译)

Find the minimum possible sum of costs of the deleted edges, modulo $998244353$. (Note that you are not minimizing the remainder modulo $998244353$.)

求删除边的代价之和的最小可能值,并对 $998244353$ 取模。(注意,你要求的是最小代价之和,而不是对 $998244353$ 取模后的最小值。)AI (CI翻译)

Constraints

约束条件

AI (CI翻译)
  • $2 \leq N \leq 2\times 10^5$
  • $N-1 \leq M \leq \min\left(\frac{N(N-1)}{2}, 2\times 10^5\right)$
  • $1 \leq U_i < V_i \leq N$
  • $(U_i, V_i) \neq (U_j, V_j)$ if $i \neq j$
  • $G$ is connected.
  • All input values are integers.
  • $2 \leq N \leq 2\times 10^5$
  • $N-1 \leq M \leq \min\left(\frac{N(N-1)}{2}, 2\times 10^5\right)$
  • $1 \leq U_i < V_i \leq N$
  • $(U_i, V_i) \neq (U_j, V_j)$ if $i \neq j$
  • $G$ 是连通图。
  • 输入的所有数值均为整数。
AI (CI翻译)

Input

输入格式

AI (CI翻译)

The input is given from Standard Input in the following format:

输入从标准输入给出,格式如下:AI (CI翻译)

N M
U_1 V_1
U_2 V_2
\vdots
U_M V_M

N M
U_1 V_1
U_2 V_2
\vdots
U_M V_M
AI (CI翻译)

Output

输出格式

AI (CI翻译)

Output the minimum possible sum of costs of the deleted edges, modulo $998244353$.

输出删除边的代价之和的最小可能值对 $998244353$ 取模后的结果。AI (CI翻译)

样例

Input #1
5 7
2 3
1 2
1 5
4 5
2 4
3 5
1 3
Output #1
22
![image](https://img.atcoder.jp/abc447/9a14605fcbaad3095d74d32d6cae6c55.png) Deleting edges $1, 2, 4$ (the edges shown as dashed lines in the figure above) makes the number of connected components of $G$ exactly $2$. In this case, the sum of costs of the deleted edges is $2^1+2^2+2^4=22$, which is the minimum.
Input #2
2 1
1 2
Output #2
2
Input #3
8 16
2 7
5 7
6 8
1 7
4 7
1 3
2 8
5 8
4 8
2 5
3 4
3 8
1 4
1 8
4 6
1 2
Output #3
54
题目信息
题号
abc447_e
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。