最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

CF 1842A - Tenzing and Tsondu

2023-06-25 09:30 作者:您是打尖兒還是住店呢  | 我要投稿

Tsondu and Tenzing are playing a card game. Tsondu has n monsters with ability values a1,a2,…,an while Tenzing has m

?monsters with ability values b1,b2,…,bm.

Tsondu and Tenzing take turns making moves, with Tsondu going first. In each move, the current player chooses two monsters: one on their side and one on the other side. Then, these monsters will fight each other. Suppose the ability values for the chosen monsters are x and y respectively, then the ability values of the monsters will become x?y and y?x respectively. If the ability value of any monster is smaller than or equal to 0, the monster dies.

The game ends when at least one player has no monsters left alive. The winner is the player with at least one monster left alive. If both players have no monsters left alive, the game ends in a draw.


Find the result of the game when both players play optimally.


Input

Each test contains multiple test cases. The first line of input contains a single integer t (1≤t≤2?103) — the number of test cases. The description of test cases follows.

The first line of each test case contains two integers n and m (1≤n,m≤50) — the number of monsters Tsondu and Tenzing have respectively.

The second line of each test case contains n integers a1,a2,…,an

?(1≤ai≤109) — the ability values of Tsondu's monsters.


The third line of each test case contains m integers b1,b2,…,bm

?(1≤bi≤109) — the ability values of Tenzing's monsters.

Output

For each test case, output "Tsondu" if Tsondu wins, "Tenzing" if Tenzing wins, and "Draw" if the game ends in a draw. (Output without quotes.)


Note that the output is case-sensitive. For example, if the answer is "Tsondu", the outputs "tsondu", "TSONDU", and "tSonDu" will all be recognized as incorrect outputs.

----------------------------------------------------------------------中文

Tsondu 和 Tenzing 正在玩紙牌游戲。 Tsondu 有 n 個能力值為 a1,a2,…,an 的怪物,而 Tenzing 有 m 個

? 能力值為 b1,b2,…,bm 的怪物。

梭杜和丹增輪流出手,梭杜先行。 在每次移動中,當(dāng)前玩家選擇兩個怪物:一個在自己這邊,一個在另一方。 然后,這些怪物就會互相爭斗。 假設(shè)所選怪物的能力值為x

? 和y分別,則怪物的能力值將分別變?yōu)閤?y和y?x。 如果任何怪物的能力值小于或等于0,則該怪物死亡。

當(dāng)至少一名玩家沒有怪物存活時(shí),游戲結(jié)束。 獲勝者是至少有一只怪物還活著的玩家。 如果雙方都沒有怪物存活,則游戲以平局結(jié)束。


求雙方都發(fā)揮最佳狀態(tài)時(shí)的游戲結(jié)果。


輸入

每個測試包含多個測試用例。 輸入的第一行包含一個整數(shù) t (1≤t≤2?103) — 測試用例的數(shù)量。 測試用例的描述如下。

每個測試用例的第一行包含兩個整數(shù)n和m(1≤n,m≤50)——Tsondu和Tenzing分別擁有的怪物數(shù)量。

每個測試用例的第二行包含n個整數(shù)a1,a2,…,an

? (1≤ai≤109) — Tsondu的怪物的能力值。


每個測試用例的第三行包含 m 個整數(shù) b1,b2,…,bm

? (1≤bi≤109) — 丹增怪物的能力值。

輸出

對于每個測試用例,如果 Tsondu 獲勝則輸出“Tsondu”,如果 Tenzing 獲勝則輸出“Tenzing”,如果游戲以平局結(jié)束則輸出“Draw”。 (輸出不帶引號。)


請注意,輸出區(qū)分大小寫。 例如,如果答案是“Tsondu”,則輸出“tsondu”、“TSONDU”和“tSonDu”都將被識別為不正確的輸出。

---------------------------------------------------------------------------------

依次while循環(huán)即可:


CF 1842A - Tenzing and Tsondu的評論 (共 條)

分享到微博請遵守國家法律
宜州市| 洮南市| 潮州市| 内黄县| 宁陵县| 赫章县| 西乡县| 全州县| 黑水县| 新晃| 恩施市| 英山县| 鹤山市| 汕头市| 炎陵县| 汾西县| 亳州市| 汤原县| 行唐县| 玛沁县| 当雄县| 长沙县| 天祝| 六枝特区| 辽中县| 黎平县| 社旗县| 淳化县| 溧水县| 简阳市| 万年县| 定襄县| 保德县| 大埔县| 呼玛县| 西城区| 牙克石市| 勃利县| 亚东县| 桦川县| 项城市|