欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1842A.Tenzing and Tsondu
Tenzing and Tsondu
Tsondu always runs first! ! !
Tsondu and Tenzing are playing a card game. Tsondu has monsters with ability values while Tenzing has monsters with ability values .
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 and respectively, then the ability values of the monsters will become and respectively. If the ability value of any monster is smaller than or equal to , 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 () — the number of test cases. The description of test cases follows.
The first line of each test case contains two integers and () — the number of monsters Tsondu and Tenzing have respectively.
The second line of each test case contains integers ) — the ability values of Tsondu's monsters.
The third line of each test case contains integers ) — 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.
Note
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 on his side to fight against a monster with ability value on Tenzing's side, the ability value of both monsters become and respectively. The monster with ability value on Tenzing's side dies.
- In the second move, Tenzing chooses a monster with ability value on his side to fight against a monster with ability value on Tsondu's side, the ability value of both monsters become and respectively. The monster with ability value on Tenzing's side dies.
- In the third move, Tsondu chooses a monster with ability value on his side to fight against a monster with ability value onTenzing's side, the ability value of both monsters become and respectively. The monster with ability value on Tenzing's side dies.
- Now, Tenzing has no monsters left alive. Since Tsondu still has monsters left alive, Tsondu wins.
Samples
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
Tsondu
Draw
Tsondu
Tenzing
Draw
Draw
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |