CF2261C.I Know About a Million Things
入门
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Moggity and Larpity are playing a game with an array a1,a2,…,an of positive integers. Moggity moves first, and then the players alternate turns.
On their turn, a player chooses a non-empty set of positions of the array and removes the elements at these positions. Such a move is allowed only if at least one of the following conditions holds:
- exactly one element is removed;
- the sum of the removed elements is even.
A player who cannot make a move loses. In other words, the player who faces an empty array loses.
Determine which player has a winning strategy.
莫吉蒂(Moggity)和拉尔皮蒂(Larpity)正在用一个由正整数构成的数组 a1,a2,…,an 进行一场游戏。莫吉蒂先手,之后双方轮流进行操作。
在一轮操作中,玩家需选择数组中一个非空的位置集合,并移除这些位置上的所有元素。该操作仅在满足以下至少一个条件时才被允许:
- 恰好移除一个元素;
- 被移除元素的总和为偶数。
无法进行合法操作的玩家判负。换言之,面对空数组的玩家输掉游戏。
请判断哪位玩家拥有必胜策略。
输入格式
Each test contains multiple test cases. The first line contains the number of test cases t (1≤t≤104). The description of the test cases follows.
The first line of each test case contains a single integer n (1≤n≤1000000) — the length of the array.
The second line of each test case contains n integers a1,a2,…,an (1≤ai≤1000000) — the elements of the array.
It is guaranteed that the sum of n over all test cases does not exceed 1000000.
每个测试包含多个测试用例。第一行包含测试用例的数量 t(1≤t≤104)。随后是各测试用例的描述。
每个测试用例的第一行包含一个整数 n(1≤n≤1000000)—— 数组的长度。
每个测试用例的第二行包含 n 个整数 a1,a2,…,an(1≤ai≤1000000)—— 数组的元素。
保证所有测试用例的 n 之和不超过 1000000。
输出格式
For each test case, print "Moggity" if Moggity has a winning strategy, and "Larpity" otherwise.
You can output the answer in any case (upper or lower). For example, the strings "MoggItY", "MOGGITY", "moggity", and "mOGGity" will be recognized as a win for Moggity.
对于每个测试用例,如果 Moggity 有必胜策略,则输出 “Moggity”;否则输出 “Larpity”。
你可以以任意大小写形式输出答案(大写或小写均可)。例如,字符串 “MoggItY”、“MOGGITY”、“moggity” 和 “mOGGity” 均会被识别为 Moggity 获胜。
输入输出样例
输入#1
3 1 7 2 2 3 6 1000000 999999 5 4 3 2
输出#1
Moggity Larpity Moggity
说明/提示
In the first test case, Moggity removes the only element, and Larpity faces an empty array.
In the second test case, Moggity cannot remove both elements at once, because 2+3=5 is odd. Whichever single element he removes, Larpity removes the remaining one, and then Moggity faces an empty array. Therefore, Larpity wins.
在第一个测试用例中,Moggity 移除了唯一的一个元素,Larpity 面对一个空数组。
在第二个测试用例中,Moggity 无法一次性移除两个元素,因为 2+3=5 是奇数。无论他移除哪一个单独的元素,Larpity 都会移除剩下的那个元素,随后 Moggity 面对一个空数组。因此,Larpity 获胜。
输入解题思路,AI测评打分。不知道怎么写?