mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-25 18:12:04 +00:00
36 lines
577 B
C++
36 lines
577 B
C++
#include <iostream>
|
|
|
|
using std::cin;
|
|
using std::cout;
|
|
const char endl = '\n';
|
|
|
|
int main() {
|
|
std::ios::sync_with_stdio(false);
|
|
cin.tie(nullptr);
|
|
|
|
int t;
|
|
|
|
cin >> t;
|
|
|
|
while (t--) {
|
|
bool flag = false, ans = true;
|
|
int n;
|
|
long long sum = 0;
|
|
|
|
cin >> n;
|
|
|
|
for (int i = 1, x; i <= n; i++) {
|
|
cin >> x;
|
|
|
|
if ((sum += x) < 0) ans = false;
|
|
|
|
if (sum == 0) flag = true;
|
|
else if (flag) ans = false;
|
|
}
|
|
|
|
cout << (ans && !sum ? "Yes" : "No") << endl;
|
|
}
|
|
|
|
return 0;
|
|
}
|