#P2812. 校园网络【[USACO] Network of Schools加强版】
校园网络【[USACO] Network of Schools加强版】
Description
There are schools (). It is known that in their designed network there are edges. To ensure high speed, the network is directed. Please tell them the minimum number of schools to select as servers (“mother machines”) so that every school can use the software. Then tell them the minimum number of edges to add so that choosing any single school as the server will allow every other school to use the software.
Input Format
The first line contains a positive integer .
The next lines each contain several integers separated by spaces.
On the -th line, several non-zero integers are given, indicating that there is a directed edge from to . The line ends with a terminating .
Output Format
The first line contains an integer, the minimum number of schools to select as servers so that every school can use the software.
The second line contains an integer, the minimum number of edges to add so that choosing any school as the server will allow every other school to use the software.
5
2 0
4 0
5 0
1 0
0
2
2
Hint
POJ original. The testdata has been enlarged by times.
, .
In fact, , .
Translated by ChatGPT 5
京公网安备 11011102002149号