poj 1422 Air Raid(最小路径覆盖)

#include 
#include 
#include 
using namespace std;
int way[1001][1001],boy[1001],girl[1001];
int m,n;
bool findways(int x)
{
    for (int i=1; i<=m; i++)
    {
        if(!girl[i]&&way[x][i])
        {
            girl[i]=1;
            if (!boy[i]||findways(boy[i]))
            {
                boy[i]=x;
                return true;
            }
        }
    }
    return false;
}
int main()
{
    int a,b,sum,T;
    scanf("%d",&T);
    while(T--)
    {
        scanf("%d %d",&m,&n);
        memset(way,0,sizeof(way));
        memset(boy,0,sizeof(boy));
        sum=0;
        for (int i=0; i

你可能感兴趣的:(ACM练习,ACM-最短路径)