CF1990A.Submission Bait

传统题 时间 2000 ms 内存 256 MiB 4 尝试 1 已通过 1 标签

Submission Bait

Alice and Bob are playing a game in an array aa of size nn.

They take turns to do operations, with Alice starting first. The player who can not operate will lose. At first, a variable mxmx is set to 00.

In one operation, a player can do:

  • Choose an index ii (1in1 \le i \le n) such that aimxa_{i} \geq mx and set mxmx to aia_{i}. Then, set aia_{i} to 00.

Determine whether Alice has a winning strategy.

Input

The first line contains an integer tt (1t1031 \leq t \leq 10^3) — the number of test cases.

For each test case:

  • The first line contains an integer nn (2n502 \leq n \leq 50) — the size of the array.
  • The second line contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n (1ain1 \leq a_i \leq n) — the elements of the array.

Output

For each test case, if Alice has a winning strategy, output "YES". Otherwise, output "NO".

You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.

Note

In the first test case, Alice can choose i=1i=1 since a1=2mx=0a_1=2 \ge mx=0.

After Alice's operation, a=[0,1]a=[0,1] and mx=2mx=2. Bob can not do any operation. Alice wins.

In the second test case, Alice doesn't have a winning strategy.

For example, if Alice chooses i=1i=1, after Alice's operation: a=[0,1]a=[0,1] and mx=1mx=1. Then, Bob can choose i=2i=2 since a2=1mx=1a_2=1 \ge mx=1. After Bob's operation: a=[0,0]a=[0,0] and mx=1mx=1. Alice can not do any operation. Bob wins.

Samples

5
2
2 1
2
1 1
3
3 3 3
4
3 3 4 4
4
1 2 2 2
YES
NO
YES
NO
YES

在线编程 IDE

建议全屏模式获得最佳体验