Asteroids POJ - 3041】的更多相关文章

   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…
Asteroids POJ - 3041 题目大意:N*N的地图里,存在一些小行星,Bessie有个很牛x但又很耗蓝的武器,一次可以消灭一行或者一列的所有小行星,问最少使用多少次这个武器可以消灭所有的小行星? 第一次做这种建图的题,把每一行和每一列都视为一个点,然后给出的小行星坐标x,y就视为在x点和y点间连一条边,那么就是求最小点覆盖,而最小点覆盖=最大匹配(具体概念和证明之后再填坑),所以直接跑一遍匈牙利算法 #include<cstdio> #include<cstring>…
  Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 17258   Accepted: 9386 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…
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的地图N   地图里面有K个障碍     你每次可以选择一条直线 消除这条直线上的所有障碍  (直线只能和列和行平行) 问最少要消除几次 题解: 如果(x,y)上有一个障碍 则把X加入点集 V1 .Y加入点集V2   并且X Y连一条边  这样构成一个新图 如果选择 V1中的点 X 那么就相当于消去 (X,y)中的所有Y    要找使最小点覆盖 那就是跑一遍 匈牙利就行了 详细证明见二分图最小点覆盖König定理 其中 x y需要连单向边 不然会造成混乱 因为x=1 y=1…
题目链接:Asteroids - POJ 3041 - Virtual Judge  https://vjudge.net/problem/POJ-3041 第一行输入一个n和一个m表示在n*n的网格里有m个小行星,接下来m行都会有一个小行星的坐标(x,y),现在有一种武器可以一次性把一行或一列上的小行星消灭掉,现在问我们最少要多少次攻击才能消灭所有的小行星. 第一次做二分图最小点覆盖的题目,思路是我们把每一行每一列都抽象成一个点,总共n*n个,行和列的点组成两个点集,那么小行星的坐标(x,y)…
POJ 3041 Asteroids / UESTC 253 Asteroids(二分图最大匹配,最小点匹配) 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), whic…
题目:POJ 3041 Asteroids http://poj.org/problem?id=3041 分析: 把位置下标看出一条边,这显然是一个二分图最小顶点覆盖的问题,Hungary就好. 挑战: 输出一组可行解.构造,已知二分图的两个点集U和V,s-U-V-t,在最大匹配的残留网络里,选从s出发能到达的V中的点 沿途可以到达的U集中的点的路径就都被覆盖了,然后在选择U集合中无法到达的点.对于二分图中任意一条边,其中必有一点属于U集合, 所以前面选出的点集S是一个覆盖.并且S中V和U对应的…
poj       3041——Asteroids Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22604   Accepted: 12247 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 g…
题目传送门 /* 题意:每次能消灭一行或一列的障碍物,要求最少的次数. 匈牙利算法:把行和列看做两个集合,当有障碍物连接时连一条边,问题转换为最小点覆盖数==二分图最大匹配数 趣味入门:http://blog.csdn.net/dark_scope/article/details/8880547 */ #include <cstdio> #include <algorithm> #include <cstring> #include <vector> usi…