#C3069. Determine the Game Winner
Determine the Game Winner
Determine the Game Winner
You are given an integer n representing the number of locations, and a list of n integers b representing the amount of firewood available at each location.
The game is played by two players, BitLGM and BitYao. Under optimal play, the winner is determined as follows:
- If n = 1: BitLGM wins.
- If n = 2: Compute the bitwise XOR of the two numbers. If the XOR equals zero, then BitYao wins; otherwise, BitLGM wins.
- For any other value of n (i.e. n ≥ 3): BitLGM wins.
Note: When performing the bitwise XOR operation, use the standard operator and consider the operation in its usual semantics.
The mathematical operation for bitwise XOR is defined as follows in \( \LaTeX \):
\( a \oplus b = c \), where each bit of \( c \) is 1 if the corresponding bits of \( a \) and \( b \) are different and 0 if they are the same.
inputFormat
The input is read from stdin and consists of two lines:
- The first line contains a single integer n, the number of locations.
- The second line contains n space-separated integers representing the amount of firewood at each location.
outputFormat
The output is a single line printed to stdout containing the name of the winner: either BitLGM
or BitYao
.
3
1 0 2
BitLGM