#P2764. 最小路径覆盖问题
最小路径覆盖问题
Description
Given a directed graph . Let be a set of simple paths (vertex-disjoint) in . If every vertex in appears in exactly one path in , then is a path cover of . Paths in can start at any vertex in , and their lengths are arbitrary; in particular, the length can be . The minimum path cover of is a path cover with the fewest number of paths. Design an efficient algorithm to find a minimum path cover of a DAG (directed acyclic graph) .
Input Format
The first line contains two positive integers and . Here is the number of vertices of the given DAG (directed acyclic graph) , and is the number of edges of . The next lines each contain two positive integers and , representing a directed edge .
Output Format
Starting from the first line, output one path per line. The last line of the file is the minimum number of paths.
11 12
1 2
1 3
1 4
2 5
3 6
4 7
5 8
6 9
7 10
8 11
9 11
10 11
1 4 7 10 11
2 5 8
3 6 9
3
Hint
Constraints: For of the testdata, , .
SPJ provided by @FlierKing.
Translated by ChatGPT 5
京公网安备 11011102002149号