Universal Cup Judging System

Universal Cup

Süre Sınırı: 1 s Bellek Sınırı: 1024 MB
İstatistikler

VegiCat 和 VegiDog 正在《杀戮尖塔》(Slay the Spire)中进行一场特殊的决斗。VegiCat 扮演观者 A,VegiDog 扮演观者 B。A 和 B 的基础攻击力分别为 $a$ 和 $b$,初始生命值分别为 $h_A$ 和 $h_B$。

problem_23595_17aa2d8990609c5348c9bf4e9d000ebd.png

在每回合开始时,游戏会决定每位观者在该回合的姿态。每位观者可以处于以下两种姿态之一:

  • 普通(Normal):造成的伤害和受到的伤害均不变。
  • 暴怒(Wrath):造成的伤害和受到的伤害均翻倍。

对于每次攻击,伤害最初等于攻击者的基础攻击力。如果攻击者处于暴怒姿态,伤害翻倍;如果防御者处于暴怒姿态,伤害再次翻倍。因此,每回合的伤害如下:

  • 如果两个角色都处于普通姿态,A 对 B 造成 $a$ 点伤害,B 对 A 造成 $b$ 点伤害。
  • 如果恰好有一个角色处于暴怒姿态,A 对 B 造成 $2a$ 点伤害,B 对 A 造成 $2b$ 点伤害。
  • 如果两个角色都处于暴怒姿态,A 对 B 造成 $4a$ 点伤害,B 对 A 造成 $4b$ 点伤害。

每回合中,两个角色同时各攻击一次,且两者的生命值同时减少。即使任一角色的生命值在回合中变为 $0$ 或更低,双方的攻击也都会生效。在回合结束时,生命值小于或等于 $0$ 的角色死亡。如果任一角色死亡,战斗立即结束;否则,开始下一回合。基础攻击力永远不会改变,生命值也永远不会恢复。

每回合的姿态由游戏决定,而非由玩家决定。在每回合中,两个角色姿态的任意组合都是可能的。

只有当 B 死亡且 A 存活时,VegiCat 才获胜。如果两个角色在同一回合死亡,VegiCat 不会获胜。请判断无论两个角色的姿态如何变化,VegiCat 是否都一定会获胜。

输入格式

第一行包含一个整数 $T$($1 \le T \le 10^5$),表示测试用例的数量。接下来是各测试用例的描述。

每个测试用例包含一行四个整数 $a$、$b$、$h_A$ 和 $h_B$($1 \le a, b, h_A, h_B \le 10^{18}$),分别表示两个角色的基础攻击力和初始生命值。

输出格式

对于每个测试用例,如果无论两个角色的姿态如何变化,VegiCat 都一定会获胜,则输出 YES,否则输出 NO。每个答案占单独一行。

你可以以任意大小写输出答案。例如,yEs、yes、Yes 和 YES 都会被接受为肯定回答。

样例

输入格式 1

5
1 1 5 1
1 1 4 1
1 1 1 1
1 1 1 5
2 3 13 2

输出格式 1

YES
NO
NO
NO
YES

输入格式 2

4
3 2 18 13
3 2 16 13
3 2 9 13
3 2 17 13

输出格式 2

YES
NO
NO
YES

说明

在第一个样例的第一个测试用例中,B 总是在第一回合死亡。A 在该回合至多受到 $4$ 点伤害并存活下来。

在第一个样例的第二个测试用例中,如果第一回合两个角色都处于普通姿态,则 A 获胜。如果第一回合两个角色都处于暴怒姿态,则两者同归于尽。因此答案为 NO。

在第二个样例的第二个测试用例中,如果前 $4$ 回合两个角色都处于普通姿态,他们剩余的生命值分别为 $8$ 和 $1$。如果在第 $5$ 回合两者都进入暴怒姿态,则两者都会死亡,因此无法保证获胜。

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.