QOJ.ac

QOJ

Límite de tiempo: 1.0 s Límite de memoria: 256 MB Puntuación total: 100

#11926. 遗迹保卫战

Estadísticas

在《Defense of the Ancients》游戏中,一方拥有 $n$ 个单位,另一方拥有 $m$ 座塔。每个单位和塔都有一定的生命值(HP)和固定的攻击力(AP)。生命值大于 0 的单位(或塔)处于存活状态,可以攻击塔(或单位);生命值为 0 的单位(或塔)则死亡(或被摧毁),无法进行任何攻击。

游戏是实时的,时间连续流逝。如果一座塔(或单位)同时受到 $k$ 个单位(或塔)的攻击,且这些攻击者的攻击力分别为 $a_1, a_2, \dots, a_k$,那么该目标单位的生命值将以每秒 $a_1 + a_2 + \dots + a_k$ 的速率持续下降。攻击范围没有限制,即任何单位都可以攻击任何塔,反之亦然。

在整个游戏过程中,存活的单位(或塔)会共同攻击选定的某一座塔(或单位),直到其被摧毁(或死亡)。也就是说,存活的单位(或塔)会集中火力逐个摧毁(或击杀)塔(或单位)。

如果所有单位都被击杀且至少有一座塔存活,则塔方获胜。如果所有塔都被摧毁且至少有一个单位存活,则单位方获胜。如果所有单位被击杀且所有塔被摧毁的时间相同,则游戏以平局结束。

双方均采取最优策略。你的任务是预测游戏的胜者。

输入格式

第一行包含测试用例的数量,最多为 10 个。

对于每个测试用例,包含 5 行。第一行包含两个整数 $n$ 和 $m$ ($0 < n \le 10^5, 0 < m \le 10^5$)。第二行包含 $n$ 个整数,表示单位的 HP。第三行包含 $n$ 个整数,表示单位的 AP。第四行包含 $m$ 个整数,表示塔的 HP。第五行包含 $m$ 个整数,表示塔的 AP。

所有 HP 和 AP 均为正整数且小于 $2^{32}$。

输出格式

对于每个测试用例,如果单位方有获胜策略,输出“Units win”;如果塔方有获胜策略,输出“Towers win”;如果游戏以平局结束,输出“Tie”。

样例

输入 1

3
1 1
10
10
9
11
2 2
1 1
5 4
2 1
4 2
3 3
1 2 3
1 4 9
1 4 9
1 2 3

输出 1

Units win
Towers win
Tie

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.