You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
492 B
23 lines
492 B
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
#define int long long
|
|
const int N = 1000010;
|
|
int a[N];
|
|
signed main() {
|
|
int T;
|
|
cin >> T;
|
|
while (T--) {
|
|
int n, sum, mx;
|
|
cin >> n;
|
|
sum = 0, mx = 0;
|
|
for (int j = 0; j < n; j++) {
|
|
cin >> a[j];
|
|
sum += a[j];
|
|
mx = mx < a[j] ? a[j] : mx;
|
|
}
|
|
if ((sum - mx) >= (mx - 1))
|
|
puts("Yes");
|
|
else
|
|
puts("No");
|
|
}
|
|
} |