QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 128 MB Puntuación total: 10

#6055. 英雄 [B]

Estadísticas

在 Bajtocki 超市的货架上,刚刚出现了一款新的电脑游戏。在游戏中,我们指挥勇敢的英雄 Bitor,他的任务是击败居住在 Bajtogród 地牢中的 $n$ 只怪物。为了简化起见,我们将怪物编号为 $1$ 到 $n$。

在与编号为 $i$ 的怪物战斗时,Bitor 会受到伤害,损失 $d_i$ 点生命值。该怪物守护着一个生命药水宝箱,在战斗获胜后,药水会为 Bitor 恢复 $a_i$ 点生命值。

Bitor 可以轻松击败怪物,但他不能让自己的生命值在任何时刻降至零(或以下)。Bitor 是否能以某种顺序与敌人战斗,从而击败所有怪物?

输入格式

输入的第一行包含两个整数 $n$ 和 $z$ ($1 \le n, z \le 100\,000$),分别表示怪物的数量和 Bitor 的初始生命值。接下来的 $n$ 行包含怪物的描述:第 $i$ 行包含两个整数 $d_i$ 和 $a_i$ ($0 \le d_i, a_i \le 100\,000$),分别表示编号为 $i$ 的怪物造成的伤害以及击败它后可以饮用的药水的功效。

输出格式

输出的第一行应包含一个单词 TAKNIE,取决于 Bitor 是否能够击败所有怪物。如果可以击败所有怪物,则还需要输出第二行,包含一个由 $1$ 到 $n$ 之间互不相同的 $n$ 个整数组成的序列,数字之间用空格隔开。该序列应描述战斗的顺序,其各项依次对应被击败怪物的编号。如果存在多个正确的答案,程序只需输出其中任意一个。

样例

输入 1

3 5
3 1
4 8
8 3

输出 1

TAK
2 3 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.