#include <stdio.h>
#include <vector>
#define MAX_N 10000
#define MAX_M 1000
using namespace std;

int N, M, adj[MAX_N][MAX_M];
vector<int> mMatch, wMatch;
vector<bool> visited;

bool dfs(int m) {
    if(visited[m]) return false;
    visited[m]=true;
    for(int w=0; w<M; ++w) 
        if(adj[m][w])
            if(wMatch[w]==-1||dfs(wMatch[w])) {
                mMatch[m]=w;
                wMatch[w]=m;
                return true;
            }
    return false;
}

int bipartiteMatch() {
    mMatch = vector<int>(N, -1);
    wMatch = vector<int>(M, -1);
    int size=0;
    for(int start=0; start<N; ++start) {
        visited = vector<bool>(N, false);
        if(dfs(start))
            ++size;
    }
    return size;
}
int main() {
    scanf("%d %d", &N, &M);
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: