QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 256 MB Total points: 100

#3687. Boss 单挑战

统计

问题描述

某 RPG 游戏中,最后一战是主角单挑 Boss,将其简化后如下:

主角的气血值上限为 $HP$,魔法值上限为 $MP$,愤怒值上限为 $SP$;Boss仅有气血值,其上限为 $M$。

现在共有 $N$ 回合,每回合都是主角先行动,主角可做如下选择之一:

  1. 普通攻击:减少对方 $X$ 的气血值,并增加自身 $DSP$ 的愤怒值。(不超过上限)
  2. 法术攻击:共有 $N_1$ 种法术,第 $i$ 种消耗 $B_i$ 的魔法值,减少对方 $Y_i$ 的气血值。(使用时要保证 $MP$ 不小于 $B_i$)
  3. 特技攻击:共有 $N_2$ 种特技,第 $i$ 种消耗 $C_i$ 的愤怒值,减少对方 $Z_i$ 的气血值。(使用时要保证 $SP$ 不小于 $C_i$)
  4. 使用 HP 药水:增加自身 $DHP$ 的气血值。(不超过上限)
  5. 使用 MP 药水:增加自身 $DMP$ 的魔法值。(不超过上限)

之后 Boss 会攻击主角,在第 $i$ 回合减少主角 $A_i$ 的气血值。

刚开始时气血值,魔法值,愤怒值都是满的。当气血值小于等于 $0$ 时死亡。

如果主角能在这 $N$ 个回合内杀死 Boss,那么先输出“Yes”,之后在同一行输出最早能在第几回合杀死 Boss。(用一个空格隔开)

如果主角一定会被 Boss 杀死,那么输出“No”。

其它情况,输出“Tie”。

输入格式

输入的第一行包含一个整数 $T$,为测试数据组数。

接下来 $T$ 部分,每部分按如下规则输入:

第一行九个整数 $N$, $M$, $HP$, $MP$, $SP$, $DHP$, $DMP$, $DSP$, $X$。

第二行 $N$ 个整数 $A_i$。

第三行第一个整数 $N_1$,接下来包含 $N_1$ 对整数 $B_i$, $Y_i$。

第四行第一个整数 $N_2$,接下来包含 $N_2$ 对整数 $C_i$, $Z_i$。

输出格式

输出共包含 $T$ 行,每行依次对应输出一个答案。

样例输入

2
5 100 100 100 100 50 50 50 20
50 50 30 30 30
1 100 40
1 100 40
5 100 100 100 100 50 50 50 10
50 50 30 30 30
1 100 40
1 100 40

样例输出

Yes 4
Tie

样例说明

对于第一个样例,主角的策略是:第一回合法术攻击,第二回合使用 HP 药水,第三回合特技攻击,第四回合普通攻击。

数据规模和约定

对于 $10\%$ 的数据:$N ≤ 10$,$N_1 = N_2 = 0$。

对于 $30\%$ 的数据:$N ≤ 10$,$N_1 = N_2 = 1$。

对于 $60\%$ 的数据:$N ≤ 100$,$M ≤ 10\,000$,$HP,MP,SP ≤ 70$。

对于 $100\%$ 的数据:$1 ≤ N ≤ 1\,000$,$1 ≤ M ≤ 1\,000\,000$,$1 ≤ HP,MP,SP ≤ 1\,000$,$N_1,N_2 ≤ 10$,$DHP,A_i ≤ HP$,$DMP,B_i ≤ MP$,$DSP,C_i ≤ SP$,$X,Y_i,Z_i ≤ 10\,000$,$1 ≤ T ≤ 10$。

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.