POJ 2446 最小点覆盖】的更多相关文章

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…
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…
#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://poj.org/problem?id=1325 Machine Schedule Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 14216   Accepted: 6075 Description As we all know, machine scheduling is a very classical problem in computer science and has been studi…
题目链接:http://poj.org/problem?id=1325 As we all know, machine scheduling is a very classical problem in computer science and has been studied for a very long history. Scheduling problems differ widely in the nature of the constraints that must be satis…
题意 给出的是N*M的矩阵,同样是有障碍的格子,要求每次只能消除一行或一列中连续的格子,最少消除多少次可以全部清除. 思路 相当于POJ 3041升级版,不同之处在于这次不能一列一行全部消掉,那些非障碍的格子不能消. 但是我们还是要抓住关键点:每个格子必须消除,要么以行消,要么以列消.并且我们发现如果以行消得话,一定是以这连续障碍行的最左端为起点,同理列是以最上端为起点.那么我们就又把消除方式变成两种了.这时就可以把障碍当作边,两种覆盖方式分别作为两断点,求二分图最小点覆盖集. 行列方式的起点共…
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 <…
题目链接:http://poj.org/problem?id=3041 在一个n*n的地图中,有m和障碍物,你每一次可以消除一行或者一列的障碍物,问你最少消除几次可以将障碍物全部清除. 用二分图将行(左边)和列(右边)用障碍物联系起来,比如(2,3)有个障碍物,那么左边的2和右边的3连边.边的个数就是障碍物的个数,点的个数就是次数,所以问题就变成了用少的点覆盖全部的边,也就是最小点覆盖问题.二分图中,最小点覆盖=最大匹配数. //最小点覆盖 = 最大匹配 #include <iostream>…
题目地址:http://poj.org/problem?id=2226 二分图的题目关键在于建图.因为“*”的地方只有两种木板覆盖方式:水平或竖直,所以运用这种方式进行二分.首先按行排列,算出每个"*"的序号xi,再按列排序,算出序号yi. 从X集合向Y集合连边.G[xi][yi]=1; 然后就是求二分图的最小顶点覆盖.因为二分图最小点覆盖=最大匹配数.所以匈牙利算法求一下最大匹配就可以了. #include<cstdio> #include<iostream>…
题目链接:Asteroids - POJ 3041 - Virtual Judge  https://vjudge.net/problem/POJ-3041 第一行输入一个n和一个m表示在n*n的网格里有m个小行星,接下来m行都会有一个小行星的坐标(x,y),现在有一种武器可以一次性把一行或一列上的小行星消灭掉,现在问我们最少要多少次攻击才能消灭所有的小行星. 第一次做二分图最小点覆盖的题目,思路是我们把每一行每一列都抽象成一个点,总共n*n个,行和列的点组成两个点集,那么小行星的坐标(x,y)…