欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1672A.Log Chopping
Log Chopping
There are logs, the -th log has a length of meters. Since chopping logs is tiring work, errorgorn and maomao90 have decided to play a game.
errorgorn and maomao90 will take turns chopping the logs with errorgorn chopping first. On his turn, the player will pick a log and chop it into pieces. If the length of the chosen log is , and the lengths of the resulting pieces are and , then and have to be positive integers, and must hold. For example, you can chop a log of length into logs of lengths and , but not into logs of lengths and , and , or and .
The player who is unable to make a chop will be the loser. Assuming that both errorgorn and maomao90 play optimally, who will be the winner?
Input
Each test contains multiple test cases. The first line contains a single integer () — the number of test cases. The description of the test cases follows.
The first line of each test case contains a single integer () — the number of logs.
The second line of each test case contains integers () — the lengths of the logs.
Note that there is no bound on the sum of over all test cases.
Output
For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes).
Note
In the first test case, errorgorn will be the winner. An optimal move is to chop the log of length into logs of length . After this there will only be logs of length and log of length .
After this, the only move any player can do is to chop any log of length into logs of length . After moves, it will be maomao90's turn and he will not be able to make a move. Therefore errorgorn will be the winner.
In the second test case, errorgorn will not be able to make a move on his first turn and will immediately lose, making maomao90 the winner.
Samples
2
4
2 4 2 1
1
1
errorgorn
maomao90
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |