Codeforces Round 311 (Div. 2)
D
Vitaly and Cycle
Codeforces
2000
原题
← CE →
翻译中…

After Vitaly was expelled from the university, he became interested in the graph theory.

翻译中…

Vitaly especially liked the cycles of an odd length in which each vertex occurs at most once.

翻译中…

Vitaly was wondering how to solve the following problem. You are given an undirected graph consisting of $*n*$ vertices and $*m*$ edges, not necessarily connected, without parallel edges and loops. You need to find $*t*$ — the minimum number of edges that must be added to the given graph in order to form a simple cycle of an odd length, consisting of more than one vertex. Moreover, he must find $*w*$ — the number of ways to add $*t*$ edges in order to form a cycle of an odd length (consisting of more than one vertex). It is prohibited to add loops or parallel edges.

翻译中…

Two ways to add edges to the graph are considered equal if they have the same sets of added edges.

翻译中…

Since Vitaly does not study at the university, he asked you to help him with this task.

翻译中…

Input

翻译中…

The first line of the input contains two integers $*n*$ and $*m*$ (image — the number of vertices in the graph and the number of edges in the graph.

翻译中…

Next $*m*$ lines contain the descriptions of the edges of the graph, one edge per line. Each edge is given by a pair of integers $*a*_{*i*}$, $*b*_{*i*}$ ($1 ≤ *a*_{*i*}, *b*_{*i*} ≤ *n*$) — the vertices that are connected by the $*i*$-th edge. All numbers in the lines are separated by a single space.

翻译中…

It is guaranteed that the given graph doesn't contain any loops and parallel edges. The graph isn't necessarily connected.

翻译中…

Output

翻译中…

Print in the first line of the output two space-separated integers $*t*$ and $*w*$ — the minimum number of edges that should be added to the graph to form a simple cycle of an odd length consisting of more than one vertex where each vertex occurs at most once, and the number of ways to do this.

翻译中…

Note

翻译中…

The simple cycle is a cycle that doesn't contain any vertex twice.

翻译中…

样例

Input #1
4 4
1 2
1 3
4 2
4 3
Output #1
1 2
InputCopy OutputCopy
Input #2
3 3
1 2
2 3
3 1
Output #2
0 1
InputCopy OutputCopy
Input #3
3 0
Output #3
3 1
InputCopy OutputCopy
题目信息
题号
557D
时间限制
1 s
内存限制
256 MB
标签
组合数学
DFS 及类似
图论
数学

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