//Place your snippets for cpp here. Each snippet is defined under a snippet name and has a prefix, body and 
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the 
// same ids are connected.
// prefix 的格式要求是 acm-[一级标题编号].[二级标题编号][该代码片段的英文简称]
// description 的格式要求是 "插入 [该代码片段的中文名]"

{
    "二分图最大匹配-匈牙利算法": {
        "prefix": "acm-3.4erfentu",
        "body": [
            "signed main() {",
            "    ios::sync_with_stdio(0);",
            "    cin.tie(0), cout.tie(0);",
            "    int n1,n2,m;",
            "    cin >> n1 >> n2 >> m;",
            "    vector<vector<int>>ver(n1+1);",
            "    for(int i = 1;i <= m;i++){",
            "        int x,y;",
            "        cin >> x >> y;",
            "        ver[x].push_back(y);",
            "    }",
            "",
            "    int ans = 0;",
            "    vector<int>match(n2+1);",
            "    for(int i = 1;i <= n1;i++){",
            "        vector<int>vis(n2+1);",
            "        auto dfs = [&](auto self,int x) -> bool {",
            "            for(auto y : ver[x]){",
            "                if(vis[y])continue;",
            "                vis[y] = 1;",
            "                if(!match[y] || self(self,match[y])){",
            "                    match[y] = x;",
            "                    return true;",
            "                }",
            "            }",
            "            return false;",
            "        };",
            "        if(dfs(dfs,i)){",
            "            ans++;",
            "        }",
            "    }",
            "    cout << ans << '\\n';",
            "    return 0;",
            "}"
        ],
        "description": "插入 二分图最大匹配-匈牙利算法"
    }
}