102624: [AtCoder]ABC262 E - Red and Blue Graph

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $500$ points

Problem Statement

You are given a simple undirected graph with $N$ vertices and $M$ edges. The vertices are numbered $1, \dots, N$, and the $i$-th $(1 \leq i \leq M)$ edge connects Vertices $U_i$ and $V_i$.

There are $2^N$ ways to paint each vertex red or blue. Find the number, modulo $998244353$, of such ways that satisfy all of the following conditions:

  • There are exactly $K$ vertices painted red.
  • There is an even number of edges connecting vertices painted in different colors.

Constraints

  • $2 \leq N \leq 2 \times 10^5$
  • $1 \leq M \leq 2 \times 10^5$
  • $0 \leq K \leq N$
  • $1 \leq U_i \lt V_i \leq N \, (1 \leq i \leq M)$
  • $(U_i, V_i) \neq (U_j, V_j) \, (i \neq j)$
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

$N$ $M$ $K$
$U_1$ $V_1$
$\vdots$
$U_M$ $V_M$

Output

Print the answer.


Sample Input 1

4 4 2
1 2
1 3
2 3
3 4

Sample Output 1

2

The following two ways satisfy the conditions.

  • Paint Vertices $1$ and $2$ red and Vertices $3$ and $4$ blue.
  • Paint Vertices $3$ and $4$ red and Vertices $1$ and $2$ blue.

In either of the ways above, the $2$-nd and $3$-rd edges connect vertices painted in different colors.


Sample Input 2

10 10 3
1 2
2 4
1 5
3 6
3 9
4 10
7 8
9 10
5 9
3 4

Sample Output 2

64

Input

题意翻译

给出一个 $N$ 个点、$M$ 条边的简单无向图,每个点可以染成红色或蓝色,所有点必须染色。求满足以下要求的染色方案数: + 有 $K$ 个点染成红色 + 两端颜色不同的边数为偶数 答案对 $998244353$ 取模。 输入的第一行是 $N,M,K$;之后 $M$ 行,每行两个整数 $U_i,V_i$,表示一条边连接的两个结点。 输出满足要求的方案数对 $998244353$ 取模的结果。 + $2\le N\le 2\times 10^5$ + $1\le M\le 2\times 10^5$ + $0\le K\le N$ + 对于 $1\le i\le N$,$1\le U_i\lt V_i \le N$ + 对于 $i\neq j$,$(U_i,V_i)\neq(U_j,V_j)$ + 输入的数据均为整数。

Output

得分:500分 部分 问题描述 给定一个具有N个顶点和M条边的简单无向图。顶点编号为1, \dots, N$,第i$ (1 \leq i \leq M)$条边连接顶点U_i$和V_i$。 有2^N$种方法将每个顶点涂成红色或蓝色。找出满足以下所有条件的方法的数量,对998244353取模:$ * 有正好K$个顶点涂成红色。 * 连接不同颜色的顶点的边的数量为偶数。$ 部分 约束条件 * $2 \leq N \leq 2 \times 10^5$ * $1 \leq M \leq 2 \times 10^5$ * $0 \leq K \leq N$ * $1 \leq U_i \lt V_i \leq N \, (1 \leq i \leq M)$ * $(U_i, V_i) \neq (U_j, V_j) \, (i \neq j)$ * 输入中的所有值都是整数。$ 部分 输入 从标准输入按以下格式给出输入: $N$ $M$ $K$ $U_1$ $V_1$ $\vdots$ $U_M$ $V_M$ $ 部分 输出 打印答案。$ 部分 样例输入1 4 4 2 1 2 1 3 2 3 3 4 $ 部分 样例输出1 2 $ 以下是满足条件的两种方法:$ * 将顶点1$和2$涂成红色,将顶点3$和4$涂成蓝色。 * 将顶点3$和4$涂成红色,将顶点1$和2$涂成蓝色。 $ 在上述两种方法中,第2$条和第3$条边连接了不同颜色的顶点。$ 部分 样例输入2 10 10 3 1 2 2 4 1 5 3 6 3 9 4 10 7 8 9 10 5 9 3 4 $ 部分 样例输出2 64 $

加入题单

算法标签: