#P2272. [ZJOI2007] 最大半连通子图
[ZJOI2007] 最大半连通子图
Description
A directed graph is called semi-connected if it satisfies: , either or , that is, for any two vertices in the graph, there exists a directed path from to or from to .
If satisfies and is the set of all edges in whose endpoints lie in , then is called an induced subgraph of . If is an induced subgraph of and is semi-connected, then is called a semi-connected subgraph of . If contains the largest number of vertices among all semi-connected subgraphs of , then is called a maximum semi-connected subgraph of .
Given a directed graph , find , the number of vertices in a maximum semi-connected subgraph of , and , the number of different maximum semi-connected subgraphs. Since may be large, output modulo .
Input Format
The first line contains three integers . and denote the number of vertices and edges of graph , respectively. The meaning of is as described above.
The next lines each contain two positive integers , representing a directed edge . Each vertex is labeled . It is guaranteed that the same does not appear twice in the input.
Output Format
Output two lines. The first line contains an integer . The second line contains an integer .
6 6 20070603
1 2
2 1
1 3
2 4
5 6
6 4
3
3
Hint
For of the testdata, , , .
Translated by ChatGPT 5
京公网安备 11011102002149号