#include<bits/stdc++.h>
using namespace std;
#define int long long
void Parallelism_solve()
{
int n;
cin >> n;
vector<int> a(n + 1, 0), b;
for (int i = 1; i <= n; i++)
{
cin >> a[i];
}
vector<int> pre(n + 1, 0);
for (int i = 1; i <= n; i++)
{
pre[i] = pre[i - 1] + a[i];
}
vector<int> Max(n + 5, -1e18 - 10);
for (int i = n; i >= 1; i--)
{
Max[i] = max(Max[i + 1], pre[n] - pre[i]);
}
int ans = Max[1], p = 0;
for (int i = 1; i <= n;i ++)
{
if (pre[i] + Max[i] > ans)
{
ans = pre[i] + Max[i];
p = pre[i];
}
}
cout << p << '\n';
}
main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
for (int i = 1; i <= t; i++)
{
Parallelism_solve();
}
}
1236D - Alice and the Doll | 1207B - Square Filling |
1676D - X-Sum | 1679A - AvtoBus |
1549A - Gregor and Cryptography | 918C - The Monster |
4B - Before an Exam | 545B - Equidistant String |
1244C - The Football Season | 1696B - NIT Destroys the Universe |
1674A - Number Transformation | 1244E - Minimizing Difference |
1688A - Cirno's Perfect Bitmasks Classroom | 219A - k-String |
952A - Quirky Quantifiers | 451B - Sort the Array |
1505H - L BREAK into program | 171E - MYSTERIOUS LANGUAGE |
630D - Hexagons | 1690D - Black and White Stripe |
1688D - The Enchanted Forest | 1674C - Infinite Replacement |
712A - Memory and Crow | 1676C - Most Similar Words |
1681A - Game with Cards | 151C - Win or Freeze |
1585A - Life of a Flower | 1662A - Organizing SWERC |
466C - Number of Ways | 1146A - Love "A" |