Number of paths
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 122.174 megabytes
Given a directed acyclic graph, your task is to partition the graph into the smallest number of vertex-disjoint paths. Each vertex must be included in exactly one path.
Input
The first line provides two integers: the number of vertices n and the number of edges k. The constraints are 1 ≤ n ≤ 500 and 0 ≤ k ≤ n · (n - 1) / 2. The next k lines each contain two integers, a and b (where 1 ≤ a, b ≤ n), representing a directed edge from vertex a to vertex b. Each edge (a, b) is unique and appears only once.
Output
Print the minimum number of paths required.
Examples
Input #1
Answer #1
Submissions 149
Acceptance rate 43%