poj 3041 最小点覆盖=最大匹配】的更多相关文章

#include<stdio.h> #include<string.h> #define  N  510 int map[N][N],n,mark[N],link[N]; int find(int u) {  int i;  for(i=1;i<=n;i++)  if(!mark[i]&&map[u][i]) {     mark[i]=1;     if(link[i]==-1||find(link[i])) {         link[i]=u;    …
解题报告 http://blog.csdn.net/juncoder/article/details/38135053 题目传送门 题意: 给出NxN的矩阵,有M个点是障碍 每次仅仅能删除一行或者一列,最少删除多少次才干清除障碍 思路: 把行和列看作两个集合结点.把障碍看作集合结点的连线.这样就转化成求用最少的点来消灭边.也就是最小点覆盖. 在二分图中:(n个结点,且没有孤立的点) 最小点覆盖=最大匹配 最大点独立=结点数-最大匹配 #include <queue> #include <…
Asteroids Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 16242 Accepted: 8833 Description Bessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 <= N <= 500). The grid contains K astero…
http://poj.org/problem?id=3041 在n*n的网格中有K颗小行星,小行星i的位置是(Ri,Ci),现在有一个强有力的武器能够用一发光速将一整行或一整列的小行星轰为灰烬,想要利用这个武器摧毁所有的小行星最少需要几发光束. 主要是构图,将每一行当成一个点,构成集合1,每一列也当成一个点,构成集合2,每一个障碍物的位置坐标将集合1和集合2的点连接起来,也就是将每一个障碍物作为连接节点的边,这样可以得出本题是一个最小点覆盖的问题==二分图的最大匹配. 就可以通过匈牙利算法求解.…
Muddy Fields Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8881   Accepted: 3300 Description Rain has pummeled the cows' field, a rectangular grid of R rows and C columns (1 <= R <= 50, 1 <= C <= 50). While good for the grass, t…
Asteroids Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 16379   Accepted: 8930 Description Bessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 <= N <= 500). The grid contains K as…
http://poj.org/problem?id=3041 Asteroids Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 12601   Accepted: 6849 Description Bessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 <= N <…
Chessboard Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 14787   Accepted: 4607 Description Alice and Bob often play games on chessboard. One day, Alice draws a board with size M * N. She wants Bob to use a lot of cards with size 1 * 2…
学习网络流中ing...作为初学者练习是不可少的~~~构图方法因为书上很详细了,所以就简单说一说 把光束作为图的顶点,小行星当做连接顶点的边,建图,由于 最小顶点覆盖 等于 二分图最大匹配 ,因此求二分图最大匹配即可. 邻接矩阵,DFS寻找增广路,匈牙利算法 邻接矩阵:复杂度O(n^3) 如果使用邻接表:复杂度O(n*m) #include<cstdio> #include<cstring> #include<cmath> #include<iostream>…
http://poj.org/problem?id=3041 Asteroids Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 17543   Accepted: 9548 Description Bessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1 <= N <…