## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

## [Solution] Everything Everywhere All But One Codeforces Solution | Codeforces Problem Solution 2022

A. Everything Everywhere All But One
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

You are given an array of $n$ integers ${a}_{1},{a}_{2},\dots ,{a}_{n}$. After you watched the amazing film "Everything Everywhere All At Once", you came up with the following operation.

In one operation, you choose $n-1$ elements of the array and replace each of them with their arithmetic mean (which doesn't have to be an integer). For example, from the array $\left[1,2,3,1\right]$ we can get the array $\left[2,2,2,1\right]$, if we choose the first three elements, or we can get the array $\left[\frac{4}{3},\frac{4}{3},3,\frac{4}{3}\right]$, if we choose all elements except the third.

Is it possible to make all elements of the array equal by performing a finite number of such operations?

Input
The first line of the input contains a single integer $t$ ($1\le t\le 200$)  — the number of test cases. The description of the test cases follows.

The first line of each test case contains a single integer $n$ ($3\le n\le 50$)  — the number of integers.
The second line of each test case contains $n$ integers ${a}_{1},{a}_{2},\dots ,{a}_{n}$ ($0\le {a}_{i}\le 100$).
Output

For each test case, if it is possible to make all elements equal after some number of operations, output $\mathtt{\text{YES}}$. Otherwise, output $\mathtt{\text{NO}}$.

You can output $\mathtt{\text{YES}}$ and $\mathtt{\text{NO}}$ in any case (for example, strings $\mathtt{\text{yEs}}$$\mathtt{\text{yes}}$$\mathtt{\text{Yes}}$ will be recognized as a positive response).