#P7953. Link with Limit
Link with Limit
Link with Limit
Problem Description
Link has a function , where and are both integers in . Let and , he define the power of a number as:
$$g(x) = \lim \limits_{n \to + \infty} \frac{1}{n} \sum_{i=1}^{n} f_i(x) $$He wants to know whether has the same power for all .
Input
The input consists of multiple test cases. The first line contains an integer () -- the number of test cases. For each test case: In the first line, there is an integer (). In the second line, there are integers, the -th integer shows the value of (). It is guaranteed that the sum of over all test cases will not exceed .
Output
For each test case, output 'YES' if all have the same power. Otherwise, output 'NO'.
Sample Input
2
2
1 2
2
1 1
Sample Output
NO
YES
Source
2021“MINIEYE杯”中国大学生算法设计超级联赛(7)