#graph901. 二分图匹配2
二分图匹配2
Bipartite Graph Matching 2
Problem Description
You are given a bipartite graph with vertices on the left side and vertices on the right side, connected by edges. Find a maximum matching and output one such matching.
Input Format
The first line contains three integers $L, R, m\ (1 \le L, R \le 10^5, 1 \le m \le 2 \times 10^5)$.
Each of the next lines contains two integers , indicating an edge. There are no duplicate edges.
Output Format
The first line outputs one number: the size of a maximum matching.
Then output several lines, each containing two numbers, representing an edge in the maximum matching.
Sample Input
4 4 7
1 1
2 2
0 0
3 1
1 2
2 0
3 2
Sample Output
3
0 0
1 1
2 2