CF1542A.Odd Set

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given a multiset (i. e. a set that can contain multiple equal integers) containing 2n2n integers. Determine if you can split it into exactly nn pairs (i. e. each element should be in exactly one pair) so that the sum of the two elements in each pair is odd (i. e. when divided by 22, the remainder is 11).

你被给定一个多重集(即可以包含多个相等整数的集合),其中含有 2n2n 个整数。请判断是否能将其恰好划分为 nn 个数对(即每个元素恰好属于一个数对),使得每个数对中两个元素的和为奇数(即除以 22 的余数为 11)。

输入格式

The input consists of multiple test cases. The first line contains an integer tt (1≤t≤1001\leq t\leq 100) — the number of test cases. The description of the test cases follows.

The first line of each test case contains an integer nn (1≤n≤1001\leq n\leq 100).

The second line of each test case contains 2n2n integers a1,a2,…,a2na_1,a_2,\dots, a_{2n} (0≤ai≤1000\leq a_i\leq 100) — the numbers in the set.

输入包含多个测试用例。第一行包含一个整数 tt(1≤t≤1001\leq t\leq 100),表示测试用例的数量。随后是各测试用例的描述。

每个测试用例的第一行包含一个整数 nn(1≤n≤1001\leq n\leq 100)。

每个测试用例的第二行包含 2n2n 个整数 a1,a2,…,a2na_1,a_2,\dots, a_{2n}(0≤ai≤1000\leq a_i\leq 100),表示集合中的数字。

输出格式

For each test case, print "Yes" if it can be split into exactly nn pairs so that the sum of the two elements in each pair is odd, and "No" otherwise. You can print each letter in any case.

对于每个测试用例,如果能恰好将其划分为 nn 个数对,使得每个数对中两个元素的和为奇数,则输出 "Yes";否则输出 "No"。你可以以任意大小写形式输出每个字母。

输入输出样例

  • 输入#1

    5
    2
    2 3 4 5
    3
    2 3 4 5 5 5
    1
    2 4
    1
    2 3
    4
    1 5 3 2 6 7 3 4

    输出#1

    Yes
    No
    No
    Yes
    No

说明/提示

In the first test case, a possible way of splitting the set is (2,3)(2,3), (4,5)(4,5).

In the second, third and fifth test case, we can prove that there isn't any possible way.

In the fourth test case, a possible way of splitting the set is (2,3)(2,3).

在第一个测试用例中,一种可能的集合划分方式是 (2,3)(2,3)、(4,5)(4,5)。

在第二、第三和第五个测试用例中,可以证明不存在任何可行的划分方式。

在第四个测试用例中,一种可能的集合划分方式是 (2,3)(2,3)。

输入解题思路,AI测评打分。不知道怎么写?

首页