voidwork(){ cin >> n; for (int i = 1; i <= n; ++i) cin >> a[i]; int sum = a[n]; for (int i = n; i > 1; --i) { if (a[i - 1] >= a[i]) continue; sum -= a[i] - a[i - 1]; if (sum < 0) return (void) puts("NO"); } puts("YES"); }
intmain(){ int T; cin >> T; while (T--) work(); return0; }