CF37B.Computer Game

普及+/提高

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Vasya’s elder brother Petya loves playing computer games. In one of his favourite computer games Petya reached the final level where a fight with the boss take place.

While playing the game Petya found spell scrolls and now he is about to use them. Let’s describe the way fighting goes on this level:

  1. The boss has two parameters: max — the initial amount of health and reg — regeneration rate per second.

  2. Every scroll also has two parameters: pow__i — spell power measured in percents — the maximal amount of health counted off the initial one, which allows to use the scroll (i.e. if the boss has more than pow__i percent of health the scroll cannot be used); and dmg__i the damage per second inflicted upon the boss if the scroll is used. As soon as a scroll is used it disappears and another spell is cast upon the boss that inflicts dmg__i of damage per second upon him until the end of the game.

During the battle the actions per second are performed in the following order: first the boss gets the damage from all the spells cast upon him, then he regenerates reg of health (at the same time he can’t have more than max of health), then the player may use another scroll (no more than one per second).

The boss is considered to be defeated if at the end of a second he has nonpositive ( ≤ 0) amount of health.

Help Petya to determine whether he can win with the set of scrolls available to him and if he can, determine the minimal number of seconds he needs to do it.

瓦西里年长的哥哥佩佳热衷于玩电脑游戏。在他最喜爱的一款游戏中,佩佳已闯入最终关卡,即将与Boss展开决战。

在游戏过程中,佩佳找到了若干卷轴法术,现在他准备使用它们。下面我们来描述本关卡中的战斗规则:

  1. Boss有两个参数:max——初始生命值;reg——每秒的生命恢复量。

  2. 每个卷轴也有两个参数:pow_i——法术威力(以百分比表示),即该卷轴可被使用的最大生命值百分比阈值(换言之,若Boss当前生命值超过初始生命值的 pow_i%,则该卷轴无法使用);dmg_i——若使用该卷轴,则对Boss每秒造成 dmg_i 点伤害。一旦某个卷轴被使用,它即消失,同时一个持续性法术被施加于Boss身上,该法术在整场游戏剩余时间内每秒对Boss造成 dmg_i 点伤害。

在战斗中,每秒内各动作按如下顺序执行:
首先,Boss承受所有已施加的持续性法术所造成的总伤害;
接着,Boss恢复 reg 点生命值(但其生命值不能超过 max);
最后,玩家可使用一个新的卷轴(每秒至多使用一个)。

当某秒结束时,若Boss的生命值为非正数(≤ 0),则判定Boss被击败。

请帮助佩佳判断:利用他手中现有的卷轴集合,是否能够获胜?若可以获胜,请确定所需的最少秒数。

输入格式

The first line contains three integers N, max and reg (1 ≤ N, max, reg ≤ 1000) –– the amount of scrolls and the parameters of the boss. The next N lines contain two integers pow__i and dmg__i each — the parameters of the i-th scroll (0 ≤ pow__i ≤ 100, 1 ≤ dmg__i ≤ 2000).

第一行包含三个整数 NN、max\text{max} 和 reg\text{reg}(1≤N,max,reg≤10001 \leq N, \text{max}, \text{reg} \leq 1000)—— 分别表示卷轴数量以及 Boss 的参数。接下来的 NN 行每行包含两个整数 powi\text{pow}_i 和 dmgi\text{dmg}_i,表示第 ii 个卷轴的参数(0≤powi≤1000 \leq \text{pow}_i \leq 100,1≤dmgi≤20001 \leq \text{dmg}_i \leq 2000)。

输出格式

In case Petya can’t complete this level, output in the single line NO.

Otherwise, output on the first line YES. On the second line output the minimal time after which the boss can be defeated and the number of used scrolls. In the next lines for each used scroll output space-separated number of seconds passed from the start of the battle to the moment the scroll was used and the number of the scroll. Scrolls are numbered starting from 1 in the input order. The first scroll is considered to be available to be used after 0 seconds.

Output scrolls in the order they were used. It is not allowed to use scrolls after the boss is defeated.

如果彼佳无法完成此关卡,则在单独一行输出 NO。

否则,在第一行输出 YES;在第二行输出击败 Boss 的最短时间(单位:秒)以及使用的卷轴数量;接下来的每一行对应一个被使用的卷轴,输出两个以空格分隔的整数:从战斗开始到使用该卷轴所经过的秒数、卷轴编号(卷轴按输入顺序从 1 开始编号);第一个卷轴视为在战斗开始后 0 秒即可使用。

请按实际使用顺序输出各卷轴信息。不允许在 Boss 被击败后使用卷轴。

输入输出样例

  • 输入#1

    2 10 3
    100 3
    99 1

    输出#1

    NO
  • 输入#2

    2 100 10
    100 11
    90 9

    输出#2

    YES
    19 2
    0 1
    10 2

输入解题思路,AI测评打分。不知道怎么写?

首页