QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 64 MB Points totaux : 100

#13802. 阿尔忒弥斯

Statistiques

宙斯给荒野女神阿尔忒弥斯一片矩形区域用来种植森林。该区域的左侧边界是正 $y$ 轴的一段,底部边界是正 $x$ 轴的一段,左下角为 $(0,0)$。宙斯告诉阿尔忒弥斯只能在区域内的整数坐标点上植树。阿尔忒弥斯希望森林看起来自然,因此她植树的方式使得连接任意两棵树的直线都不平行于 $x$ 轴或 $y$ 轴。

有时,宙斯想让阿尔忒弥斯为他砍树。砍树的要求如下:

  • 宙斯希望至少为他砍伐给定数量 $T$ 的树木。
  • 为了获得一个用于未来足球成功的矩形足球场,阿尔忒弥斯需要砍掉某个矩形区域内的所有树木,而该区域外的树木一律不砍。
  • 该矩形区域的边必须平行于 $x$ 轴和 $y$ 轴。
  • 该区域的两个对角顶点必须位于树木上,因此这两个顶点处的树木也会被砍掉。

由于阿尔忒弥斯很爱护树木,她希望在满足这些条件的同时,砍掉尽可能少的树木。你需要编写一个程序,在给定森林信息和需要砍伐的最少树木数量 $T$ 的情况下,为阿尔忒弥斯选择一个砍树的区域。

输入格式

第一行包含一个整数 $N$,表示森林中树木的数量。

第二行包含一个整数 $T$,表示需要砍伐的最少树木数量。

接下来的 $N$ 行描述这 $N$ 棵树的位置。这些行中的每一行都包含两个整数 $X$ 和 $Y$,分别表示一棵树的 $x$ 坐标和 $y$ 坐标。

输出格式

输出应包含一行,其中有两个由一个空格隔开的整数 $I$ 和 $J$:阿尔忒弥斯应该使用第 $I$ 棵树(其位置在输入的第 $I+2$ 行给出)和第 $J$ 棵树(其位置在输入的第 $J+2$ 行给出)作为砍树区域的对角顶点。这两个数字的顺序无关紧要。可能存在多种选择这些树木的方法,你只需要找到并输出其中一种即可。对于所有的测试用例,至少存在一个解。

样例

输入样例 1

3
2
1 1
2 3
5 6

输出样例 1

1 2

数据范围

在所有输入中,$1 < N \le 20000$,$0 \le X, Y \le 64000$ 且 $1 < T \le N$。

此外,在 $50\%$ 的输入中,$1 < N < 5000$。

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.