CF1842A.Tenzing and Tsondu

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Tsondu always runs first! ! !

Tsondu and Tenzing are playing a card game. Tsondu has nn monsters with ability values a1,a2,,ana_1, a_2, \ldots, a_n while Tenzing has mm monsters with ability values b1,b2,,bmb_1, b_2, \ldots, b_m .

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 xx and yy respectively, then the ability values of the monsters will become xyx-y and yxy-x respectively. If the ability value of any monster is smaller than or equal to 00 , 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.

输入格式

Each test contains multiple test cases. The first line of input contains a single integer tt ( 1t21031 \le t \le 2 \cdot 10^3 ) — the number of test cases. The description of test cases follows.

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

The second line of each test case contains nn integers a1,a2,,ana_1,a_2,\ldots,a_n (1ai109(1 \leq a_i \leq 10^9 ) — the ability values of Tsondu's monsters.

The third line of each test case contains mm integers b1,b2,,bmb_1,b_2,\ldots,b_m (1bi109(1 \leq b_i \leq 10^9 ) — the ability values of Tenzing's monsters.

输出格式

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.

输入输出样例

  • 输入#1

    6
    1 3
    9
    1 2 3
    2 3
    1 2
    1 1 1
    3 2
    1 2 3
    1 1
    3 3
    1 1 1
    2 2 2
    10 10
    1 2 3 3 2 2 1 1 2 2
    3 3 3 3 2 1 1 1 1 1
    10 10
    1 2 3 4 5 6 7 8 9 10
    6 7 8 9 10 11 1 1 1 1

    输出#1

    Tsondu
    Draw
    Tsondu
    Tenzing
    Draw
    Draw

说明/提示

Consider the first test case. It can be shown that Tsondu has a winning strategy. The following is a possible way that Tsondu can win (note that the players may not be playing optimally in this example):

  • In the first move, Tsondu chooses a monster with ability value 99 on his side to fight against a monster with ability value 11 on Tenzing's side, the ability value of both monsters become 88 and 8-8 respectively. The monster with ability value 8-8 on Tenzing's side dies.
  • In the second move, Tenzing chooses a monster with ability value 22 on his side to fight against a monster with ability value 88 on Tsondu's side, the ability value of both monsters become 6-6 and 66 respectively. The monster with ability value 6-6 on Tenzing's side dies.
  • In the third move, Tsondu chooses a monster with ability value 66 on his side to fight against a monster with ability value 33 onTenzing's side, the ability value of both monsters become 33 and 3-3 respectively. The monster with ability value 3-3 on Tenzing's side dies.
  • Now, Tenzing has no monsters left alive. Since Tsondu still has monsters left alive, Tsondu wins.
首页