CF1672A.Log Chopping

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

There are nn logs, the ii-th log has a length of aia_i 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 22 pieces. If the length of the chosen log is xx, and the lengths of the resulting pieces are yy and zz, then yy and zz have to be positive integers, and x=y+zx=y+z must hold. For example, you can chop a log of length 33 into logs of lengths 22 and 11, but not into logs of lengths 33 and 00, 22 and 22, or 1.51.5 and 1.51.5.

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?

共有 nn 根原木,其中第 ii 根原木的长度为 aia_i 米。由于劈原木是一项非常辛苦的工作,errorgorn 和 maomao90 决定玩一个游戏。

errorgorn 和 maomao90 将轮流劈原木,errorgorn 先手。在自己的回合中,玩家需选择一根原木并将其劈成 22 段。若所选原木长度为 xx,劈出的两段长度分别为 yy 和 zz,则 yy 与 zz 必须为正整数,且必须满足 x=y+zx = y + z。例如,你可以将一根长度为 33 的原木劈成长度分别为 22 和 11 的两段,但不能劈成长度为 33 和 00、22 和 22,或 1.51.5 和 1.51.5 的两段。

无法进行劈砍操作的玩家判负。假设 errorgorn 和 maomao90 均采取最优策略,那么谁将获胜?

输入格式

Each test contains multiple test cases. The first line contains a single integer tt (1≤t≤1001 \leq t \leq 100) — the number of test cases. The description of the test cases follows.

The first line of each test case contains a single integer nn (1≤n≤501 \leq n \leq 50) — the number of logs.

The second line of each test case contains nn integers a1,a2,…,ana_1,a_2, \ldots, a_n (1≤ai≤501 \leq a_i \leq 50) — the lengths of the logs.

Note that there is no bound on the sum of nn over all test cases.

每个测试包含多个测试用例。第一行包含一个整数 tt(1≤t≤1001 \leq t \leq 100),表示测试用例的数量。随后是各测试用例的描述。

每个测试用例的第一行包含一个整数 nn(1≤n≤501 \leq n \leq 50),表示原木的数量。

每个测试用例的第二行包含 nn 个整数 a1,a2,…,ana_1,a_2, \ldots, a_n(1≤ai≤501 \leq a_i \leq 50),表示各根原木的长度。

注意:所有测试用例的 nn 之和没有上界。

输出格式

For each test case, print "errorgorn" if errorgorn wins or "maomao90" if maomao90 wins. (Output without quotes).

对于每个测试用例,如果 errorgorn 获胜,则输出 “errorgorn”;如果 maomao90 获胜,则输出 “maomao90”。(不带引号)

输入输出样例

  • 输入#1

    2
    4
    2 4 2 1
    1
    1

    输出#1

    errorgorn
    maomao90

说明/提示

In the first test case, errorgorn will be the winner. An optimal move is to chop the log of length 44 into 22 logs of length 22. After this there will only be 44 logs of length 22 and 11 log of length 11.

After this, the only move any player can do is to chop any log of length 22 into 22 logs of length 11. After 44 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.

在第一个测试用例中,errorgorn 将获胜。一种最优操作是将长度为 44 的原木砍成两段长度均为 22 的原木。此后,场上将仅剩 44 段长度为 22 的原木和 11 段长度为 11 的原木。

此后,双方玩家唯一可行的操作是将任意一段长度为 22 的原木砍成两段长度均为 11 的原木。经过 44 次操作后,轮到 maomao90 行动,而他将无法再进行任何操作。因此 errorgorn 获胜。

在第二个测试用例中,errorgorn 在他的第一回合便无法进行任何操作,立即判负,故 maomao90 获胜。

输入解题思路,AI测评打分。不知道怎么写?

首页