//// Created by 刘宇韬 on 2022年3月19日.//#include "bits/stdc++.h"using namespace std;typedef long long LL;const int N = 110;bool g[N][N];bool st[N];int n,m,k;int match[N];bool dfs(int u ){for(int i = 0; i <m; i++) {if (!st[i]&&g[u][i]){st[i] = true;if(match[i]==-1|| dfs(match[i])){match[i] = u;return true;}}}return false;}int main(){while (cin>>n>>m>>k,n){memset(g, 0,sizeof g);memset(match, -1, sizeof match);//读入每个任务for(int i = 0; i <k; i++) {int c,a,b;cin>>c>>a>>b;//因为2台机器初始都在模式0,所以用到0的任务不用后续处理if (a==0||b==0 )continue;//表示a->b有一条边g[a][b] = true;}int res= 0;for(int i = 0 ; i <n; i++) {memset(st,0,sizeof st);if (dfs(i))res++;}cout<<res;}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。