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

歡迎光臨散文網(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的評論 (共 條)

分享到微博請遵守國家法律
阳春市| 中阳县| 鹿泉市| 许昌市| 沅陵县| 长顺县| 渝北区| 宿州市| 茂名市| 金塔县| 洪泽县| 恩施市| 安阳市| 南华县| 留坝县| 栾川县| 日土县| 兴业县| 台州市| 宁武县| 阿城市| 肥西县| 宁化县| 怀宁县| 太仓市| 昌乐县| 江城| 启东市| 合阳县| 永新县| 兖州市| 郸城县| 中山市| 星座| 赞皇县| 嵊州市| 搜索| 东乡县| 大宁县| 舞阳县| 石渠县|