2028: [USACO 2024 February Contest Silver] Problem 3. Moorbles
题目描述
Bessie and Elsie are playing a game of Moorbles. The game works as follows: Bessie and Elsie each start out with some amount of marbles. Bessie holds out of her marbles in her hoof and Elsie guesses if is Even or Odd. If Elsie is correct, she wins the marbles from Bessie and if she guesses incorrectly, she loses of her marbles to Bessie (if Elsie has less than marbles, she loses all her marbles). A player loses when they lose all of their marbles.
After some amount of turns in the game, Elsie has
marbles. She thinks it is hard to win, but she is playing to not lose. After being around Bessie enough, Elsie has a good read on Bessie's habits and recognizes that on turn , there are only different amounts of marbles that Bessie may put out. There are only turns before Bessie gets bored and stops playing. Can you identify a lexicographically minimum turn sequence such that Elsie will not lose, regardless of how Bessie plays?
输入
- First, one line containing three integers , , and , representing the number of marbles Elsie has, the number of turns, and the number of potential moves Bessie can make respectively.
- Then, lines where line contains distinct space separated integers () representing the possible amounts of marbles that Bessie might play on turn .
输出
Note: "Even" is lexicographically smaller than "Odd".
样例输入
2
10 3 2
2 5
1 3
1 3
10 3 3
2 7 5
8 3 4
2 5 6
样例输出
Even Even Odd
-1
提示
In the first case, the only lexicographically smaller sequence of moves is "Even Even Even", but Bessie can make Elsie lose in that case by first playing , which reduces Elsie's number of marbles from to , then playing , which reduces Elsie's number of marbles from to , then playing , which wipes out all of her marbles.
If Elsie instead plays the correct move sequence "Even Even Odd", then if Bessie plays the same way, at the end when she plays , Elsie will gain those marbles, increasing her number of marbles to . It can further be shown that Bessie cannot play in a different way to take all of Elsie's marbles given that Elsie plays "Even Even Odd".
In the second case, it can be shown that for any move sequence that Elsie could choose, Bessie can play in a way to take all of Elsie's marbles.
SAMPLE INPUT:
1
20 8 2
3 5
3 5
3 5
3 5
3 5
3 5
3 5
3 5
SAMPLE OUTPUT:
Even Even Even Odd Even Odd Even Odd
SCORING:
- Input 3: .
- Inputs 4-6: .
- Inputs 7-12: No further constraints.