#include<stdio.h>
#include<math.h>
#include<string.h>
#define max 110
int xx[max],yy[max];
int v[max*max][max];
double map[max*max][max];
int pi[max];
int fang[max];
int m,n,t1,t2,s;
double dis(int x1,int y1,int x2,int y2)
{
return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}
int dfs(int i)
{
for(int j=1;j<=m;j++)
{
if(fang[j]==0&&v[i][j]==1)
{
fang[j]=1;
if(pi[j]==0||dfs(pi[j]))
{
pi[j]=i;
return 1;
}
}
}
return 0;
}
int fun(double h)
{
int i,j,p;
for(i=1;i<=m*n;i++)
for(j=1;j<=m;j++)
{
if(map[i][j]<=h)
v[i][j]=1;
else v[i][j]=0;
}
p=0;
memset(pi,0,sizeof(pi));
for(i=1;i<=m*n;i++)
{
memset(fang,0,sizeof(fang));
if(dfs(i))
p++;
}
if(p==m)
return 1;
else return 0;
}
int main()
{
int i,j,k;
double x,y,anss,mid;
while(sca
zzuli1672--二分答案+最大匹配
最新推荐文章于 2020-09-25 20:36:13 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)