#t110. 平衡序列

平衡序列

Balanced Sequence

Problem Background

A corresponding multiple-choice / true-or-false problem: https://ti.luogu.com.cn/problemset/1159

Problem Description

Xiaoyang has a sequence aa of nn positive integers. He considers a sequence balanced if and only if there exists a positive integer ii (1≤i<n1 \le i < n) such that the sum of the first ii numbers equals the sum of the numbers from position i+1i+1 to nn.

Xiaoyang wants you to tell whether the sequence aa is balanced.

Input Format

This problem contains multiple test cases within a single test point. The first line is a positive integer tt, the number of test cases.

This is followed by tt test cases. Each test case spans two lines:

  • The first line contains a positive integer nn, the length of the sequence.
  • The second line contains nn positive integers, the elements of sequence aa.

Output Format

For each test case output one line containing a string. If aa is balanced, output Yes; otherwise output No.

Sample Input

3
3
1 2 3
4
2 3 1 4
5
1 2 3 4 5

Sample Output

Yes
Yes
No

Sample Explanation

  • For the first test case, taking i=2i = 2 gives 1+2=31 + 2 = 3, so the sequence is balanced.
  • For the second test case, taking i=2i = 2 gives 2+3=1+42 + 3 = 1 + 4, so the sequence is balanced.
  • For the third test case, no such ii exists.

Constraints

For all test data, 1≤t≤1001 \le t \le 100, 1≤n,ai≤100001 \le n, a_i \le 10000.