logo AlgoBeat OnlineJudge
登录 注册

#101693. [BZOJ 1693] [Usaco2007 Demo]Asteroids

内存限制:64 MiB 时间限制:5000 ms 标准输入输出
题目类型:传统 评测方式:文本比较
上传者: 匿名

题目描述

Bessie wants to navigate her spaceship through a dangerous asteroid field in the shape of an N x N grid (1

输入格式

  • 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

输出格式

  • Line 1: The integer representing the minimum number of times Bessie must shoot.

样例

样例输入

3 4
1 1
1 3
2 2
3 2

INPUT DETAILS:

The following diagram represents the data, where "X" is an
asteroid and "." is empty space:
X.X
.X.
.X.

样例输出

2

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).