Spectral::Cup 2026 Round 1 (Codeforces Round 1094, Div. 1 + Div. 2)
A
A Wonderful Contest
Codeforces
800
原题
←B →
翻译中…

As a person who loves competitions, you now need to participate in a wonderful OI contest.

翻译中…

This contest has $n$ problems, each with a full score of $100$. The $i$-th problem has $a_i$ subtasks, and each subtask has a score of $\frac{100}{a_i}$. It is guaranteed that $a_i$ is a divisor of $100$.

翻译中…

Now, several contestants will participate in this contest. Suppose a contestant solves $x_i$ ($0\le x_i\le a_i$) subtasks of the $i$-th problem; his score on the $i$-th problem will be $x_i \cdot \frac{100}{a_i}$. The total score of the contestant in the contest is the sum of the scores on all problems, i.e., $\sum\limits_{i=1}^{n} x_i \cdot \frac{100}{a_i}$.

翻译中…

To prove that the contest is a truly wonderful one, you have to check whether it is possible to achieve every integer total score from $0$ to $100\cdot n$ (inclusive). Formally, you have to determine whether the following statement holds:

翻译中…
  • For every integer $k$ where $0\le k\le 100\cdot n$, there exists an array $x$ of length $n$ ($0\le x_i\le a_i$) such that $k=\sum\limits_{i=1}^{n} x_i \cdot \frac{100}{a_i}$.
翻译中…

Input

翻译中…

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

翻译中…

The first line of each test case contains a single integer $n$ ($1 \le n \le 10$) — the number of problems in the contest.

翻译中…

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 100$) — the number of subtasks of each problem. It is guaranteed that every $a_i$ is a divisor of $100$.

翻译中…

Output

翻译中…

For each test case, output "Yes" if it is possible to obtain an arbitrary total score between $0$ and $100\cdot n$; 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, for every integer $k$ ($0 \leq k \leq 200$), it is possible to achieve a total score of exactly $k$. For example, when $k=10$, a contestant who passes $0$ subtasks in the first problem and $2$ subtasks in the second problem achieves a total score of $0 \cdot \frac{100}{100} + 2 \cdot \frac{100}{20} = 10$.

翻译中…

In the second test case, when $k=95$, it can be proven that it is impossible to achieve a total score of exactly $95$.

翻译中…

In the third test case, for every integer $k$ ($0 \leq k \leq 300$), it is possible to achieve a total score of exactly $k$. For example, when $k=233$, a contestant who passes $25$, $83$, and $25$ subtasks in the three problems, respectively, achieves a total score of $25 \cdot \frac{100}{50} + 83 \cdot \frac{100}{100} + 25 \cdot \frac{100}{25} = 233$.

翻译中…

样例

Input #1
5
2
100 20
2
10 10
3
50 100 25
4
1 2 5 20
10
100 1 2 4 5 10 20 25 50 100
Output #1
Yes
No
Yes
No
Yes
InputCopy OutputCopy
题目信息
题号
2222A
时间限制
1 s
内存限制
256 MB
标签
暴力
动态规划
数学

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