当之后你不记得标题由何而来时,请回顾codeforces round 918(div4)的E题
/*这道题的核心就是题干中等式的转化,然后利用前缀和。还要注意flag[0] = 1不能漏,不然就都是yes了*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 2e5;
const int mod = 1e6 + 7;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
int t;
cin >> t;
while (t--)
{
ll n, a[maxn], sum = 0;
int f = 0;
map<ll, ll>flag;
flag[0] = 1;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> a[i];
}
for (int i = 0; i < n; i++)
{
if (i % 2 == 0)
{
a[i] = -a[i];
}
sum += a[i];
if (flag[sum])
{
f = 1;
break;
}
flag[sum]++;
}
if (f)
{
cout << "YES" << endl;
}
else
{
cout << "NO" << endl;
}
}
return 0;
}