http://acm.hdu.edu.cn/showproblem.php?pid=4619
二分图匹配 最小点覆盖 = 最大匹配
#include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int map[][];
struct node
{
int x,y;
}p[],q[];
int n,m,vis[],link[];
int judge(int i,int j)
{
if(p[i].x<=q[j].x&&q[j].x<=p[i].x+)
{
if(q[j].y<=p[i].y&&p[i].y<=q[j].y+)
return ;
}
return ;
}
int find(int x)
{
int i;
for(i = ;i <= m ; i++)
{
if(map[x][i]&&!vis[i])
{
vis[i] = ;
if(link[i]==||find(link[i]))
{
link[i] = x;
return ;
}
}
}
return ;
}
int main()
{
int i,j,k;
while(cin>>n>>m)
{
if(n==&&m==)
break;
for(i = ; i <= n ; i++)
cin>>p[i].x>>p[i].y;
for(i = ; i <= m ;i++)
cin>>q[i].x>>q[i].y;
memset(map,,sizeof(map));
memset(link,,sizeof(link));
for(i = ; i <= n ; i++)
for(j = ; j <= m ;j++)
if(judge(i,j))
map[i][j] = ;
int sum = ;
for(i = ; i <= n ; i++)
{
memset(vis,,sizeof(vis));
if(find(i)) sum++;
}
cout<<n+m-sum<<endl;
}
return ;
}