poj 3041 Asteroids(最小点覆盖)】的更多相关文章

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 <…
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…
题意 给出一个N*N的矩阵,有些格子上有障碍,要求每次消除一行或者一列的障碍,最少消除多少次可以全部清除障碍. 思路 把关键点取出来:一个障碍至少需要被它的行或者列中的一个消除. 也许是最近在做二分图匹配专辑吧--很容易想到这就是最小点覆盖集:每条边都至少需要一个点被选中,称这条边被覆盖. 而由König定理可知二分图最小点覆盖 = 最大匹配.所以解法也就出来了:把行当作左点集,列当作右点集,对于每一个障碍,把它的行和列对应的点连一条边,此二分图的最大匹配就是答案了. 代码 using name…
原题 本题为最小点覆盖,而最小点覆盖=最大二分图匹配 //最小点覆盖:用最少的点(左右两边集合的点)让每条边都至少和其中一个点关联. #include<cstdio> #include<cstring> #define N 510 using namespace std; int edge[N][N],n,m,lover[N],ans; bool vis[N]; bool find(int x) { for (int i=1;i<=n;i++) if (edge[x][i]…
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 asteroids (1 <= K <= 10,000), which are conveniently located at the lattice points of the…
   Asteroids POJ - 3041 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 asteroids (1 <= K <= 10,000), which are conveniently located at the lattice po…
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 asteroids (1 <= K <= 10,000), which are conveniently located at the lattice points of the grid. Fortun…
题意: 假如你如今正处在一个N*N的矩阵中,这个矩阵里面有K个障碍物,你拥有一把武器,一发弹药一次能消灭一行或一列的障碍物,求最小的弹药消灭所有障碍物 输入为:     N K 接下来有K行,每行包括障碍物的坐标,即r行c列; 如: 3 4  1 1 1 3 2 2 3 2 输出为:     花费最小的弹药数 思路:将i行作为X集合.将j列作为Y集合.这样原来的问题-用最少的炮弹打掉所有障碍物,转化为了这么一个问题: 在二分图中选择尽量少的点,使得每条边至少有一个端点被选中 裸的最小点覆盖问题,…
题目大意:给你一个N*N的矩阵, 里面有K个星球, 我们可以让武器攻击矩阵的一行或者一列来使得这个星球被击碎, 现在问你最少需要几个这种武器才能把所有的星球击碎? 解题思路:关键是建模构图 把每一行当成一个行节点(也当成一把武器,因为一把武器可以消灭一行),构成集合1,每一列当成一个列节点(也当成一把武器,因为一把武器可以消灭一列),构成集合2,则共有2*N(N个行节点,N个列节点,即2*N把武器)节点.若某行某列有一个障碍物,则该行节点和该列节点之间构成一条边.每一个障碍物的位置坐标将集合1与…
Asteroids Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22905   Accepted: 12421 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 a…