Codeforces Round 254 (Div. 2)
B
DZY Loves Chemistry
Codeforces
1400
原题
← AC →
翻译中…

DZY loves chemistry, and he enjoys mixing chemicals.

翻译中…

DZY has $*n*$ chemicals, and $*m*$ pairs of them will react. He wants to pour these chemicals into a test tube, and he needs to pour them in one by one, in any order.

翻译中…

Let's consider the danger of a test tube. Danger of an empty test tube is $1$. And every time when DZY pours a chemical, if there are already one or more chemicals in the test tube that can react with it, the danger of the test tube will be multiplied by $2$. Otherwise the danger remains as it is.

翻译中…

Find the maximum possible danger after pouring all the chemicals one by one in optimal order.

翻译中…

Input

翻译中…

The first line contains two space-separated integers $*n*$ and $*m*$ image.

翻译中…

Each of the next $*m*$ lines contains two space-separated integers $*x*_{*i*}$ and $*y*_{*i*}$ $(1 ≤ *x*_{*i*} < *y*_{*i*} ≤ *n*)$. These integers mean that the chemical $*x*_{*i*}$ will react with the chemical $*y*_{*i*}$. Each pair of chemicals will appear at most once in the input.

翻译中…

Consider all the chemicals numbered from $1$ to $*n*$ in some order.

翻译中…

Output

翻译中…

Print a single integer — the maximum possible danger.

翻译中…

Note

翻译中…

In the first sample, there's only one way to pour, and the danger won't increase.

翻译中…

In the second sample, no matter we pour the $1$st chemical first, or pour the $2$nd chemical first, the answer is always $2$.

翻译中…

In the third sample, there are four ways to achieve the maximum possible danger: 2-1-3, 2-3-1, 1-2-3 and 3-2-1 (that is the numbers of the chemicals in order of pouring).

翻译中…

样例

Input #1
1 0
Output #1
1
InputCopy OutputCopy
Input #2
2 1
1 2
Output #2
2
InputCopy OutputCopy
Input #3
3 2
1 2
2 3
Output #3
4
InputCopy OutputCopy
题目信息
题号
445B
时间限制
1 s
内存限制
256 MB
标签
DFS 及类似
并查集
贪心

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。