CF1857A Array Coloring

题目描述

# Array Coloring 给你一个由 $n$ 个整数组成的数组。求是否存在一种方案可以给这个数组染上两种颜色,每个元素都需要染上颜色,使得两种颜色的元素之和有相同的奇偶性。 举个例子,如果这个数组是 \[ $ 1,2,4,3,2,3,5,4 $ \],我们可以按如下方式染色:\[ $ \color{blue}{1},\color{blue}{2},\color{red}{4},\color{blue}{3},\color{red}{2},\color{red}{3},\color{red}{5},\color{red}{4} $ \],蓝色的元素之和为 $6$, 而红色的元素之和为 $18$。两者均为偶数。 第二个样例中,仅有两种染色方案:$ [\color{blue}{4},\color{red}{7}] $ 和 $ [\color{red}{4},\color{blue}{7}] $,不过对于这两种方案,两种颜色的元素的奇偶性都是不相同的。 第三个样例中,你可以这样染色: $ [\color{blue}{3},\color{blue}{9},\color{red}{8}] $ 蓝色元素之和为 $12$,而红色元素之和为 $8$,两者均为偶数,符合条件。

输入格式

第一行:一个整数 $ t $ ( $ 1 \le t \le 1000 $ ) — 表示测试样例的数量。 **对于每个测试样例:** 第一行:一个整数 $ n $ ( $ 2 \le n \le 50 $ ) — 代表数组 $a$ 的长度。 第二行:有 $n$ 个整数 $ a_1,a_2, \dots, a_n $ ( $ 1 \le a_i \le 50 $ ) — 代表 $ a $ 的元素。

输出格式

对于每个测试样例,如果存在一种染色方案符合题目要求,则输出 `YES`。反之输出 `NO`。 另外,你可以以任意方式输出 `YES` 和 `NO`,像 `yES`,`yes`,和 `Yes` 都会被视作正确答案。 ## 样例 #1 ### 样例输入 #1 ``` 7 8 1 2 4 3 2 3 5 4 2 4 7 3 3 9 8 2 1 7 5 5 4 3 2 1 4 4 3 4 5 2 50 48 ``` ### 样例输出 #1 ``` YES NO YES YES NO YES YES ```

说明/提示

The first sample is described in the statement. In the second sample, there are only two colorings $ [\color{blue}{4},\color{red}{7}] $ and $ [\color{red}{4},\color{blue}{7}] $ , but in both cases the parity of sums is different. In the third sample, you can color $ [\color{blue}{3},\color{blue}{9},\color{red}{8}] $ and $ 12 $ and $ 8 $ are both even.