QOJ.ac

QOJ

Límite de tiempo: 3.0 s Límite de memoria: 512 MB Puntuación total: 100

#16086. March of the Penguins

Estadísticas

在南极附近的某个地方,有一些企鹅站在一些冰滩上。作为群居动物,企鹅们希望聚集在同一个冰滩上。企鹅们不想弄湿身体,因此它们必须利用有限的跳跃距离,通过在冰滩之间跳跃来聚集在一起。然而,最近气温一直很高,冰滩上出现了裂缝,并且由于跳跃到另一个冰滩所需的反作用力,它们会受到进一步的损坏。幸运的是,企鹅是研究冰滩裂缝的真正专家,它们确切地知道在每个冰滩解体并消失之前,企鹅最多可以从该冰滩跳走多少次。降落在冰滩上不会对其造成损坏。你需要帮助企鹅找到所有它们可以相聚的冰滩。

含有 3 只企鹅的冰滩样本布局。

输入格式

第一行包含一个正整数:测试用例的数量,最多为 $100$。对于每个测试用例:

  • 一行,包含整数 $N$($1 \le N \le 100$)和浮点数 $D$($0 \le D \le 100\,000$),分别表示冰滩的数量和企鹅能跳跃的最大距离。
  • $N$ 行,每行包含 $x_i, y_i, n_i$ 和 $m_i$,分别表示每个冰滩的 $X$ 和 $Y$ 坐标、该冰滩上的企鹅数量,以及在冰滩消失前企鹅最多可以从该冰滩跳走的次数($-10\,000 \le x_i, y_i \le 10\,000$,$0 \le n_i \le 10$,$1 \le m_i \le 200$)。

输出格式

对于每个测试用例:

  • 输出一行,包含一个按升序排列的、以空格分隔的 0 起始索引列表,表示所有企鹅可以相聚的冰滩。如果不存在这样的冰滩,则输出一行,仅包含单个数字 $-1$。

样例

输入样例 1

2
5 3.5
1 1 1 1
2 3 0 1
3 5 1 1
5 1 1 1
5 4 0 1
3 1.1
-1 0 5 10
0 0 3 9
2 0 1 1

输出样例 1

1 2 4
-1

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.