The main topic: to find the minimum point of two-dimensional coverage and maximum independent set.
Title Analysis: If a point is selected, then all edges connected to this point are overwritten, so that the minimum point set that all edges are overwritten is called the minimum point overlay, which equals the maximum match, and the largest point set with no edges connected between any two points is called the maximum independent set, which equals the total number of nodes minus the maximum number of matches.
The code is as follows:
# include<iostream># include<cstdio># include<cmath># include<vector># include<list># include<queue># include<map># include<set># include<cstring># include<algorithm> using namespace std;const int n=1000;const int inf=1000000000;const double inf=1e20;int N,m;int link[n+5];vector<int& Gt;e[n+5];int mark[n+5];bool Match (int x) {for (int i=0;i<e[x].size (); ++i) {int y=e[x][i];if (mark[y]) continue;mark[ Y]=1;if (link[y]==-1| | Match (Link[y])) {Link[y]=x;return true;}} return false;} int main () {while (~scanf ("%d%d", &n,&m)) {for (int i=0;i<n;++i) e[i].clear (), int a,b;while (m--) {scanf ("%d%d ", &a,&b);--a,--B;e[a].push_back (b); E[b].push_back (a);} int Cnt=0;memset (link,-1,sizeof), for (int i=0;i<n;++i) {memset (mark,0,sizeof (Mark)), if (Match (i)) ++cnt;} cnt/=2;printf ("%d\n%d\n", cnt,n-cnt);} return 0;}
Hihocoder #1127: Minimum point coverage and maximum independent set of binary graphs