Codeforces Round 1008 (Div. 2)
A
Final Verdict
Codeforces
800
原题
←B →
翻译中…

You are given an array $a$ of length $n$, and must perform the following operation until the length of $a$ becomes $1$.

翻译中…

Choose a positive integer $k \lt |a|$ such that $\frac{|a|}{k}$ is an integer. Split $a$ into $k$ subsequences$^{\text{∗}}$ $s_1, s_2, \ldots, s_k$ such that:

翻译中…
  • Each element of $a$ belongs to exactly one subsequence.
  • The length of every subsequence is equal.
翻译中…

After this, replace $a = \left[ \operatorname{avg}(s_1), \operatorname{avg}(s_2), \ldots, \operatorname{avg}(s_k) \right] $, where $\operatorname{avg}(s) = \frac{\sum_{i = 1}^{|s|} s_i}{|s|}$ is the average of all the values in the subsequence. For example, $\operatorname{avg}([1, 2, 1, 1]) = \frac{5}{4} = 1.25$.

翻译中…

Your task is to determine whether there exists a sequence of operations such that after all operations, $a = [x]$.

翻译中…

$^{\text{∗}}$A sequence $x$ is a subsequence of a sequence $y$ if $x$ can be obtained from $y$ by the deletion of several (possibly, zero or all) elements.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 500$). The description of the test cases follows.

翻译中…

The first line of each test case contains two integers $n$, $x$ ($1 \leq n, x \leq 100$) — the length of the array $a$ and the final desired value.

翻译中…

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \leq a_i \leq 100$) — the array $a$.

翻译中…

Output

翻译中…

For each test case, output "YES'" (without quotes) if there exists such a sequence of operations, and "NO" (without quotes) otherwise.

翻译中…

You can output "YES" and "NO" in any case (for example, strings "yES", "yes" and "Yes" will be recognized as a positive response).

翻译中…

Note

翻译中…

In the first test case, $x = 3$ and $a = [3]$ already holds.

翻译中…

In the second test case, $x = 9$, and there exists no sequence of operations such that after all operations, $a = [9]$.

翻译中…

In the third test case, $x = 9$, and here is one possible sequence of operations.

翻译中…
  1. $k = 2$, $s_1 = [1, 12, 8]$ and $s_2 = [9, 14, 10]$. Hence, $a = [\operatorname{avg}(s_1), \operatorname{avg}(s_2)] = [7, 11]$.
  2. $k = 1$ and $s_1 = [7, 11]$. Hence, $a = [\operatorname{avg}(s_1)] = [9]$.
翻译中…

In the fourth test case, $x = 10$, and here is one possible sequence of operations.

翻译中…
  1. $k = 1$ and $s_1 = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10]$. Hence, $a = [\operatorname{avg}(s_1)] = [10]$.
翻译中…

样例

Input #1
4
1 3
3
4 9
7 11 2 5
6 9
1 9 14 12 10 8
10 10
10 10 10 10 10 10 10 10 10 10
Output #1
YES
NO
YES
YES
InputCopy OutputCopy
题目信息
题号
2078A
时间限制
1 s
内存限制
256 MB
标签
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。