hiho week 118 register

Ended

Participants:1068

Verdict:Accepted
Score:100 / 100
Submitted:2016-10-07 15:01:49

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
int M,N,cnt;
int head[600],visit[600],match[600];//match-1
struct Edge{
    int to,next;
}edge[20050];
void addedge(int u,int v){
    edge[cnt].to=v;
    edge[cnt].next=head[u];
    head[u]=cnt++;
}
bool find(int a){   //a
    for(int p=head[a];p>0;p=edge[p].next){   //p.next=-1
        int v=edge[p].to;
        if(visit[v]==-1)
        {
            visit[v]=1;
            if(match[v]==-1||find(match[v])){
                match[v]=a;
                return true;
            }
        }
    }
    return false;
}
int maxmatch(){    //
    int ans=0;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX