poj3041
来源:互联网 发布:论文数据造假有人查吗 编辑:程序博客网 时间:2024/04/29 17:44
模板题
/*POJ30412016年7月25日11:02:09*/#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <cstring>#include <cstdio>#include <string>#include <algorithm>#include <cmath>#define F(i,a,b) for(int i=a;i<=b;i++)#define f(i,a,b) for(int i=a;i<b;i++)#define mem(a,b); memset(a,b,sizeof(a));#define put(a); cout<<a<<endl;#define intab bool cmp(int a, int b){ return a>b; }using namespace std;const int maxn = 500 + 10;int K, M, N;bool map[maxn][maxn], vis[maxn];int link[maxn];int ta, tb;int cnt;bool dfs(int x){F(i, 1, M)if (map[x][i] && !vis[i]){vis[i] = 1;if (!link[i] || dfs(link[i])){link[i] = x; return true;}}return false;}int main(){while (cin >> M){scanf("%d", &K);mem(map, 0);mem(link, 0);cnt = 0;F(i, 1, K)scanf("%d%d", &ta, &tb), map[ta][tb] = 1;F(i, 1, M){mem(vis, 0);if (dfs(i))++cnt;}put(cnt);}return 0;}/*3 41 11 32 23 22*/
0 0
- poj3041
- poj3041
- poj3041
- poj3041
- poj3041
- POJ3041
- POJ3041
- poj3041
- poj3041
- POJ3041
- poj3041
- poj3041
- poj3041
- poj3041
- POJ3041 Asteroids
- poj3041题解
- poj3041 asteroids
- poj3041 Asteroids
- poj 3348
- Android提醒微技巧,你真的了解Dialog、Toast和Snackbar吗?
- hibernate5.1 配置postgres的数据库表映射文件
- 多态理解及程序
- 10 000小时的标准----是否有先天的才能
- poj3041
- unity3d中使用状态机
- 实现退出功能
- apk反编译xml文件
- 102. Binary Tree Level Order Traversal
- [转]Java多态之Override
- 浅析CA证书
- 【精】TCP/IP协议简介(一) 之 TCP/IP简介
- 网络攻击技术开篇——SQL Injection