#P16264. [蓝桥杯 2026 省 Python B 组] 奇偶博弈
[蓝桥杯 2026 省 Python B 组] 奇偶博弈
Problem Description
Xiao Lan and Xiao Qiao are playing a game based on a sequence.
At the beginning, a sequence of length , , is given. Every element in the sequence is a positive odd integer.
Xiao Lan moves first, and they take turns to make moves. In each move, the current player needs to choose an element in the sequence that is strictly greater than , and replace it with a non-negative integer that is strictly smaller than it (that is, ).
This replacement must strictly satisfy the following parity constraints:
- If the chosen is odd, then it must be replaced with .
- If the chosen is even, then the new number must also be even.
When it is a player's turn, if they cannot make any legal replacement, then they lose the game and the other player wins.
Assume both Xiao Lan and Xiao Qiao are extremely smart and always use the optimal strategy. Determine who will win this game in the end.
Input Format
The first line contains an integer , indicating the number of test cases.
Then test cases follow.
For each test case:
- The first line contains an integer , indicating the length of the sequence.
- The second line contains positive odd integers , separated by spaces.
Output Format
For each test case, output one line. If Xiao Lan wins, output L; if Xiao Qiao wins, output Q.
2
2
5 1
2
1 1
L
Q
Hint
Constraints
For all testdata, , , .
It is guaranteed that the sum of over all test cases does not exceed , and it is guaranteed that all in the initial input are odd.
Translated by ChatGPT 5