TZC Asteroids 【二分最大匹配做】
2009-11-12 09:08
260 查看
Asteroids
时间限制(普通/Java):1000MS/10000MS 运行内存限制:65536KByte总提交: 6 测试通过: 1
[b]描述
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.
Fortunately, Bessie has a powerful weapon that can vaporize all the asteroids in any given row or column of the grid with a single shot.This weapon is quite expensive, so she wishes to use it sparingly.Given the location of all the asteroids in the field, find the minimum number of shots Bessie needs to fire to eliminate all of the asteroids.
输入
* Line 1: Two integers N and K, separated by a single space.
* Lines 2..K+1: Each line contains two space-separated integers R and C (1 <= R, C <= N) denoting the row and column coordinates of an asteroid, respectively.
输出
* Line 1: The integer representing the minimum number of times Bessie must shoot.
样例输入
3 4 1 1 1 3 2 2 3 2
样例输出
2
提示
INPUT DETAILS:
The following diagram represents the data, where "X" is an asteroid and "." is empty space:
X.X
.X.
.X.
OUTPUT DETAILS:
Bessie may fire across row 1 to destroy the asteroids at (1,1) and (1,3), and then she may fire down column 2 to destroy the asteroids at (2,2) and (3,2).
[/b]
相关文章推荐
- HDU3468 Treasure Hunting(中等) [最大流](二分匹配)+最短路
- HDU 3829 Cat VS Dog (二分匹配求最大独立集)
- 最大流,最小割,二分匹配,题目列表
- uva 12549 Sentry Robots 最大二分匹配
- poj 1247 The Perfect Stall 裸的二分匹配,但可以用最大流来水一下
- poj 1325 Machine Schedule 二分匹配,可以用最大流来做
- [置顶] 白话二分匹配之最大匹配+附上hdu2063解题报告
- BZOJ 4443: [Scoi2015]小凸玩矩阵 二分图最大匹配+二分
- pku 3041 Asteroids(最小点覆盖,最大二分匹配)
- 求最大权二分匹配的KM算法
- HDU 2768 Cat vs. Dog 【二分匹配之最大独立集】
- hdu1179Ollivanders: Makers of Fine Wands since 382 BC. (二分最大匹配)
- hdu2444 The Accomodation of Students(推断二分匹配+最大匹配)
- 二分匹配求最大匹配数和最大匹配值
- 利用匈牙利算法&Hopcroft-Karp算法解决二分图中的最大二分匹配问题
- poj3020 匈牙利算法+公式:二分无向图的最小路径覆盖 = 顶点数 - 最大二分匹配数 / 2
- 最大流练习:Parking,二分匹配
- hdu 3829 Cat VS Dog (二分匹配 求 最大独立集)
- 最大流 & 二分匹配模板
- 最大二分匹配