zoukankan      html  css  js  c++  java
  • bzoj1191: [HNOI2006]超级英雄Hero

    裸匈牙利。我已经15题1A了(捂脸)

    #include<cstdio>
    #include<iostream>
    #include<cstring>
    #include<cstdlib>
    #include<algorithm>
    #include<cmath>
    using namespace std;
    
    struct node
    {
        int x,y,next;
    }a[21000];int len,last[11000];
    void ins(int x,int y)
    {
        len++;
        a[len].x=x;a[len].y=y;
        a[len].next=last[x];last[x]=len;
    }
    
    int match[11000];
    bool v[11000];
    bool findmuniu(int x)
    {
        for(int k=last[x];k;k=a[k].next)
        {
            int y=a[k].y;
            if(v[y]==false)
            {
                v[y]=true;
                if(match[y]==0||findmuniu(match[y])==true)
                {
                    match[y]=x;
                    return true;
                }
            }
        }
        return false;
    }
    
    int main()
    {
        int n,m,x;
        scanf("%d%d",&n,&m);
        len=0;memset(last,0,sizeof(last));
        for(int i=1;i<=m;i++)
        {
            scanf("%d",&x);ins(i,x+1);
            scanf("%d",&x);ins(i,x+1);
        }
        
        memset(match,0,sizeof(match));
        for(int i=1;i<=m;i++)
        {
            memset(v,false,sizeof(v));
            if(findmuniu(i)==false)
            {
                printf("%d
    ",i-1);
                return 0;
            }
        }
        printf("%d
    ",m);
        return 0;
    }
  • 相关阅读:
    在k8s中部署jenkins
    k8s CI/CD介绍
    k8s 构建jenkinsslave
    k8s 安全框架
    k8s RBAC介绍
    k8s 存储小结
    k8s 实施准备工作
    k8s 网络示例
    jenkins在kubernetes中动态创建代理
    k8s 鉴权 授权 准入控制
  • 原文地址:https://www.cnblogs.com/AKCqhzdy/p/8425178.html
Copyright © 2011-2022 走看看