#C4285. Magic Equalization
Magic Equalization
Magic Equalization
You are given several test cases. In each test case, you are given a sequence of integers. There is a mysterious magic operation available, but its power is extremely limited: it does nothing to change the values of the numbers. Effectively, the only way to have all elements equal is if they are already all the same initially.
Formally, for a sequence \(a_1, a_2, \dots, a_n\), output YES
if and only if \(a_1 = a_2 = \dots = a_n\); otherwise, output NO
.
Note: You will be reading input from standard input and writing output to standard output.
inputFormat
The input begins with a single integer T representing the number of test cases. Each test case is described on one or more lines. For each test case:
- The first integer is
n
(\(1 \le n \le 10^5\)), the number of elements in the sequence. - Followed by
n
integers separated by spaces.
All input values are provided via standard input.
outputFormat
For each test case, print a single line containing YES
if all the integers in the sequence are equal, or NO
otherwise. The output should be written to standard output.
4
3 2 4 8
4 5 5 5 5
2 7 21
5 1 2 3 4 5
NO
YES
NO
NO
</p>