题目描述
Problem Description
Given a bipartite graph with the number of left-side vertices being $n$, the number of right-side vertices being $m$, and the number of edges being $e$, find the maximum number of matching edges.
The left-side vertices are numbered from $1$ to $n$, and the right-side vertices are numbered from $1$ to $m$.
Input Format
The first line of input contains three integers, representing $n$, $m$, and $e$ respectively.
The following $e$ lines each contain two integers $u$ and $v$, indicating that there is an edge connecting the left-side vertex $u$ and the right-side vertex $v$.
Output Format
Output a single integer, which represents the maximum number of matching edges in the bipartite graph.
Sample Input and Output
Sample Input #1
1 1 1
1 1
Sample Output #1
1
Sample Input #2
4 2 7
3 1
1 2
3 2
1 1
4 2
4 1
1 1
Sample Output #2
2
Notes
Data Size and Constraints
For all test cases, the following constraints apply:
- $1 \leq n, m \leq 500$.
- $1 \leq e \leq 5 \times 10^4$.
- $1 \leq u \leq n$, $1 \leq v \leq m$.
The provided graph may contain duplicate edges.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分