欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF2171C1.Renako Amaori and XOR Game (easy version)
Renako Amaori and XOR Game (easy version)
Yup. I couldn't do this any longer. No. Freaking. Way.— Renako Amaori
This is the easy version of the problem. The only difference between the easy and hard versions is that in the easy version, .
Renako is stuck between a rock and a hard place... and by that, of course, I mean Ajisai and Mai! Both of them want to hang out with her, and she just can't decide! So Ajisai and Mai have decided to play the XOR game.
Ajisai and Mai are given arrays and of length (). They will play a game that lasts for turns, where Ajisai moves on odd-numbered turns and Mai moves on even-numbered turns. On the -th turn, the player to move may choose to swap and , or pass.
Note that if a swap occurs, the index that is being swapped must match the turn number. For example, on the first turn, Ajisai may choose to swap and , or pass. On the second turn, Mai may choose to swap and , or pass. This continues for turns. Thus, only Ajisai can swap odd indices, and only Mai can swap even indices.
At the end of the game, Ajisai achieves a score of , and Mai achieves a score of . The player with the higher score wins. If the players have the same score, the game ends in a tie.
Determine the outcome of the game with optimal play. More formally, one player is considered to win with optimal play if there exists a strategy for them such that they always win, regardless of their opponent's choices. The game is considered a tie with optimal play if neither player has such a strategy.
denotes the bitwise XOR operation
Input
The first line contains a single integer () — the number of test cases.
The first line of each test case contains a single integer ().
The second line of each test case contains integers, ().
The third line of each test case contains integers, ().
It is guaranteed that the sum of over all test cases does not exceed .
Output
For each test case, output on a single line "Ajisai" if Ajisai wins with optimal play, "Mai" if Mai wins with optimal play, or "Tie" if the game ends in a tie with optimal play.
You may output the answer in any case (upper or lower). For example, the strings "mAi", "mai", "MAI", and "maI" will be recognized as "Mai".
Note
In the first example, one way the game might play out is as follows:
On turn 1, Ajisai chooses to swap and . Now the arrays are and .
On turn 2, Mai chooses to pass.
On turn 3, Ajisai chooses to swap and . Now the arrays are and .
On turn 4, Mai chooses to swap and . Now the arrays are and .
Now, Ajisai's final score is and Mai's final score is . Therefore, Ajisai wins the game.
It is not guaranteed that the above description is representative of optimal play.
Samples
6
4
1 0 0 1
1 0 1 1
6
0 1 1 1 1 0
0 0 1 0 1 1
4
0 0 1 0
1 0 1 1
5
1 0 1 1 1
0 1 1 1 0
6
1 1 1 1 1 1
1 1 1 1 1 1
5
0 1 0 0 1
1 0 0 1 1
Ajisai
Mai
Tie
Ajisai
Tie
Mai
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |