*本题于2023/8/1增强了数据,之前提交的代码不重测。
Chen loves bipartite graph matching problems. As a cat, Chen also loves playing with woolen balls. So she thinks the graph should be dense.
And here's The Cute Cat Matching Problem:
Given a bipartite graph with 2n2n2n nodes and n(n−1)2\frac{n(n-1)}{2}2n(n−1) edges, guaranteed that there are no edges between nodes 1,2,…,n{1,2,\dots,n}1,2,…,n. There are no edges between nodes n+1,n+2,…,2n{n+1,n+2,\dots,2n}n+1,n+2,…,2n too. Also, there's no edge between iii (1≤i≤n1\le i\le n1≤i≤n) and i+ni+ni+n. If there's an edge between iii (1≤i,j≤n1\le i,j\le n1≤i,j≤n) and j+nj+nj+n, then there will be no edge between jjj and i+ni+ni+n. That means the given graph guarantees that there'll be exactly one edge between (i,j+n)(i,j+n)(i,j+n) and (i+n,j)(i+n,j)(i+n,j).
Help Chen find the maximum matching of the given graph.