| Game of Coders 3.0 |
|---|
| Finished |
Eddard suspects his partner is a vampire. Can you help him find out the truth?
Everyone knows only vampires drink cappuccino, so Eddard decided to do a little trick. He would leave some cappuccino on a table where his partner is, then come back and check if his partner drank (or added) any.
Eddard put $$$n$$$ cups of cappuccino on the table and measured the amount of cappuccino in every cup, but he only had a small piece of paper, so he couldn't write down how much each cup had. Instead, he could only write down one number. So, he decided to encode the information into one number using a function.
He defined $$$F(a) = \sum_{i=1}^{n} (i*a_i)$$$ where $$$a$$$ is an array of $$$n$$$ integers. He then wrote down the result of $$$F(c)$$$ on the piece of paper, where $$$c_i$$$ is the amount of cappuccino in the $$$i$$$-th cup.
Eddard left the cups at the table and came back after a while and measured the cups again and found that the amount of cappuccino in the $$$i$$$-th cup is now $$$p_i$$$. Can you help Eddard find out if the amount of cappuccino possibly stayed the same?
Assume that neither the number of cups nor their positions changed.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ $$$(1 \le t \le 10^4)$$$. The description of the test cases follows.
The first line of each test case contains two integers $$$n, F(c)$$$ $$$(1 \le n \le 10^6, 0 \le F(c) \le 10^{18})$$$.
The second line of each test case contains $$$n$$$ integers $$$p_1, p_2, ..., p_n$$$ $$$(0 \le p_i \le 10^9)$$$.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^6$$$.
For each test case, if the amount of cappuccino in the cups has certainly changed, print "NO". Otherwise, print "YES".
You can output the answer in any case (for example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as a positive answer).
55 302 4 2 1 24 10010 10 10 101 543 201 4 11 00
YES YES NO NO YES
Remember to use fast I/O.
In the first test case, $$$F(p) = F(c) = 30$$$. Thus, it is possible that the amount of cappuccino has not changed.
In the third test case, however, $$$F(p) = 4$$$, which differs from $$$F(c)$$$. So, it is certain that the amount of cappuccino changed.
Note that in the first test case, it is possible that the amount of cappuccino has changed. For example, $$$c$$$ could be equal to $$$\{2, 2, 2, 2, 2\}$$$, which would still lead to $$$F(p) = F(c)$$$. The answer is still "YES" as the question is about the possibility of the cups not changing.
| Name |
|---|


