P10444 "MYOI-R3" Range
Description
For a sequence $c$, define the range of $c$ as the difference between the maximum value and the minimum value in $c$. Now you are given a sequence $a$ of length $n$. Determine whether it is possible to split it into at least two subsequences, each of length greater than $1$, such that the range of every subsequence is equal (note that all elements must be assigned, and each element can be assigned to only one subsequence).
Input Format
**This problem contains multiple test cases**.
The first line contains two integers $T,id$, representing the number of test cases and the subtask ID.
For each test case:
The first line contains a positive integer $n$, representing the length of the array.
The second line contains $n$ integers representing the sequence $a$.
Output Format
For each test case, output one line containing a string `Yes` or `No`.
Explanation/Hint
### Explanation for Sample $\small\text{1}$
The sample satisfies the constraints of Subtask 1, with $id=1$.
Query 1:
It can be proven that no solution satisfies the conditions.
Query 2:
One valid set of subsequences is:
- $\{1,9\}$.
- $\{1,9\}$.
- $\{8,1,0\}$.
The answer is not unique.
### Constraints
**This problem uses bundled testdata**.
- Subtask 1 (20 points): $4\le \sum n\le 20,a_i\ge 0$.
- Subtask 2 (20 points): $4\le \sum n\le 100,a_i\ge 0$.
- Subtask 3 (20 points): $4\le \sum n\le 10^3,a_i\ge 0$.
- Subtask 4 (10 points): all elements in array $a$ are equal.
- Subtask 5 (30 points): no special restrictions.
For $100\%$ of the testdata, $4\le \sum n\le 10^6,0\le |a_i|\le 10^9,1\le T\le 300$.
Translated by ChatGPT 5