QOJ.ac

QOJ

時間限制: 5 s 記憶體限制: 1024 MB 總分: 100

#4967. 方形渔网

统计

如今许多活动都已转为线上,我们也要去进行一次虚拟钓鱼之旅!

给定 $n$ 个点的 $(x,y)$ 坐标(每个点代表一条鱼)以及一个正方形(代表渔网),请问一次最多能捕到多少条鱼?你可以将正方形渔网放置在任何位置,但其边必须平行于 $X$ 轴和 $Y$ 轴。如果一条鱼位于渔网内部或边界上,则视为被捕获。

输入格式

第一行包含两个整数:$s$ ($1 \le s \le 100$),表示渔网的边长;以及 $n$ ($1 \le n \le 100$),表示鱼的数量。接下来的 $n$ 行,每行包含两个整数(均在 $1$ 到 $100$ 之间),表示一条鱼的 $(x,y)$ 坐标。假设没有两条鱼位于同一位置。

输出格式

输出你最多能捕获的鱼的数量。

样例

输入 1

3 8
2 1
2 3
5 1
5 2
3 2
4 2
10 5
11 5

输出 1

6

输入 2

50 2
10 5
11 5

输出 2

2

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.