307486: CF1363A. Odd Selection

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Odd Selection

题意翻译

## 题目描述 给出一个 $n$ 项的数列,要求选出 $x$ 个数(不要求连续),使这 $x$ 个数的和为奇数。判断这是否可能。 ## 输入格式 第一行一个整数 $t (1 \le t \le 100)$ ,表示测试数据的组数。 接下来的 $2t$ 行描述这 $t$ 组数据: 第一行两个整数 $n,x(1\le x\le n\le 1000)$ ,分别表示数列的项数和需要选出的项数。 第二行 $n$ 个整数,表示数列的 $n$ 项,第$i(1\le i\le n)$ 项满足 $1\le ai\le 1000$ 。 ## 输出格式 输出共 $t$ 行,其中第 $i$ 行表示对于第 $i$ 组数据,是否存在一种选法,使得被选出的 $x$ 个数之和为奇数。可以则输出`Yes`,不可以则输出`No`。其中`Yes,No`中每个字符的大小写不限。 ## 样例说明 对于第一组数据,我们必须选出 $999$ ,其为奇数。 对于第二组数据,我们必须选出 $1000$ ,其不是奇数。 对于第三组数据,我们可以选择 $51$ ,使得总和为奇数。 对于第四组数据,我们必须选择 $51$ 与 $50$ ,和为 $51+50=101$ 为奇数。 对于第五组数据,我们必须选择全部的三个数,但是总和并不是奇数。

题目描述

Shubham has an array $ a $ of size $ n $ , and wants to select exactly $ x $ elements from it, such that their sum is odd. These elements do not have to be consecutive. The elements of the array are not guaranteed to be distinct. Tell him whether he can do so.

输入输出格式

输入格式


The first line of the input contains a single integer $ t $ $ (1\le t \le 100) $ — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers $ n $ and $ x $ $ (1 \le x \le n \le 1000) $ — the length of the array and the number of elements you need to choose. The next line of each test case contains $ n $ integers $ a_1, a_2, \dots, a_n $ $ (1 \le a_i \le 1000) $ — elements of the array.

输出格式


For each test case, print "Yes" or "No" depending on whether it is possible to choose $ x $ elements such that their sum is odd. You may print every letter in any case you want.

输入输出样例

输入样例 #1

5
1 1
999
1 1
1000
2 1
51 50
2 2
51 50
3 3
101 102 103

输出样例 #1

Yes
No
Yes
Yes
No

说明

For $ 1 $ st case: We must select element $ 999 $ , and the sum is odd. For $ 2 $ nd case: We must select element $ 1000 $ , so overall sum is not odd. For $ 3 $ rd case: We can select element $ 51 $ . For $ 4 $ th case: We must select both elements $ 50 $ and $ 51 $ — so overall sum is odd. For $ 5 $ th case: We must select all elements — but overall sum is not odd.

Input

题意翻译

## 题目描述 给出一个 $n$ 项的数列,要求选出 $x$ 个数(不要求连续),使这 $x$ 个数的和为奇数。判断这是否可能。 ## 输入格式 第一行一个整数 $t (1 \le t \le 100)$ ,表示测试数据的组数。 接下来的 $2t$ 行描述这 $t$ 组数据: 第一行两个整数 $n,x(1\le x\le n\le 1000)$ ,分别表示数列的项数和需要选出的项数。 第二行 $n$ 个整数,表示数列的 $n$ 项,第$i(1\le i\le n)$ 项满足 $1\le ai\le 1000$ 。 ## 输出格式 输出共 $t$ 行,其中第 $i$ 行表示对于第 $i$ 组数据,是否存在一种选法,使得被选出的 $x$ 个数之和为奇数。可以则输出`Yes`,不可以则输出`No`。其中`Yes,No`中每个字符的大小写不限。 ## 样例说明 对于第一组数据,我们必须选出 $999$ ,其为奇数。 对于第二组数据,我们必须选出 $1000$ ,其不是奇数。 对于第三组数据,我们可以选择 $51$ ,使得总和为奇数。 对于第四组数据,我们必须选择 $51$ 与 $50$ ,和为 $51+50=101$ 为奇数。 对于第五组数据,我们必须选择全部的三个数,但是总和并不是奇数。

加入题单

上一题 下一题 算法标签: