#include<iostream>
#include<stdio.h>
#include<string.h>
#include<limits.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#define MAX 101
using namespace std;
int p,n;
bool map[MAX][MAX];
bool visit[MAX];
int match[MAX];
struct point
{
double x;
double y;
};
vector<point> gopher,holes;
double dist(point a,point b)
{
return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
void can(double v,double s)
{
int i,j;
for(i=0;i<p;i++)
{
for(j=0;j<n;j++)
{
if(dist(gopher[i],holes[j])/v<=s)
{
map[i+1][j+1]=true;
}
}
}
}
bool find(int k)
{
int i,j;
for(i=1;i<=n;i++)
{
if(map[k][i]&&visit[i]==false)
{
visit[i]=true;
if(match[i]==0||find(match[i]))
{
match[i]=k;
return true;
}
}
}
return false;
}
int hungary()
{
memset(match,0,sizeof(match));
int sum=0;
for(int i=1;i<=p;i++)
{
memset(visit,0,sizeof(visit));
if(find(i))
sum++;
}
return sum;
}
int main()
{
int t,i,j,k;
double v,s;
point g;
while(scanf("%d%d%lf%lf",&p,&n,&s,&v)!=EOF)
{
gopher.clear();
holes.clear();
memset(map,0,sizeof(map));
for(i=0;i<p;i++)
{
scanf("%lf%lf",&g.x,&g.y);
gopher.push_back(g);
}
for(i=0;i<n;i++)
{
scanf("%lf%lf",&g.x,&g.y);
holes.push_back(g);
}
can(v,s);
printf("%d\n",p-hungary());
}
}
poj2536
最新推荐文章于 2019-08-10 21:11:00 发布