描述
传送门：UVaLive4597
You are in charge of a team that inspects a new ski resort. A ski resort is situated on several mountains and consists of a number of slopes. Slopes are connected with each other, forking and joining. A map of the ski resort is represented as an acyclic directed graph. Nodes of the graph represent different points in ski resort and edges of the graph represent slopes between the points, with the direction of edges going downwards.
Your team has to inspect each slope of the ski resort. Ski lifts on this resort are not open yet, but you have a helicopter. In one flight the helicopter can drop one person into any point of the resort. From the drop off point the person can ski down the slopes, inspecting each slope as they ski. It is fine to inspect the same slope multiple times, but you have to minimize the usage of the helicopter. So, you have to figure out how to inspect all the slopes with the fewest number of helicopter flights.
Input
Input consists of several datasets. The first line of each dataset contains a single integer number $n$ $(2 ≤ n ≤ 100)$ — the number of points in the ski resort. The following $n$ lines of the input file describe each point of the ski resort numbered from $1$ to $n$. Each line starts with a single integer number $m_i$ ($0 ≤ m_i < n$ for $i$ from $1$ to $n$) and is followed by mi integer numbers aij separated by spaces. All $a_{ij}$ are distinct for each $i$ and each $a_{ij}$ $(1 ≤ a_{ij} ≤ n, a_{ij} ≠ i)$ represents a slope going downwards from point $i$ to point $a_{ij}$ . Each point in the resort has at least one slope connected to it.
Output
On the first line for each dataset write a single integer number $k$ — the minimal number of helicopter flights that are needed to inspect all slopes. Then write $k$ lines that describe inspection routes for each helicopter flight. Each route shall start with single integer number from $1$ to $n$ — the number of the drop off point for the helicopter flight, followed by the numbers of points that will be visited during inspection in the corresponding order as the slopes are inspected going downwards. Numbers on a line shall be separated by spaces. You can write routes in any order.
Sample Input
1  8 
Sample Output
1  4 
思路
 由于每条边至少走一次，所以可以理解为一个有源汇的有下界（下界为1）的最小流。（源汇自己加，连接每个点，容量无穷大）
 对于求解有有源汇的最小流，姿势有很多。这题我是分离必要弧之后，跑附加源汇的最大流，二分答案（即汇点到源点的边的容量上界）。（还有一个更好的姿势可以看）
 输出路径的话，只要记录每个边的访问次数，然后去DFS一下就好了，具体要注意的细节看代码。
代码
1 
