'''
name: MD Murad Hossain
Gmail: [email protected]
||||\\\ ////|||| |||| |||| ||||\\\\\\\\\ ///////// ||||\\\\\\\\
|||| \\\ //// |||| |||| |||| |||| \\\\ //// \\\\ |||| \\\\
|||| \\\ //// |||| |||| |||| |||| \\\\ //// \\\\ |||| \\\\
|||| \\\ //// |||| |||| |||| |||| \\\\ //// \\\\ |||| \\\\
|||| ===== |||| |||| |||| ||||======== //// \\\\ |||| \\\\
|||| |||| \\\\ //// |||| \\\\ ////===========\\\\ |||| \\\\
|||| |||| \\\\ //// |||| \\\\ //// \\\\ |||| \\\\
|||| |||| ============ |||| \\\\ //// \\\\ ||||/////////
'''
import sys ; input = sys.stdin.readline
for _ in range(int(input())):
n, arr= int(input()),[]
for _ in range(2): arr.append(list(map(int,input().split())))
mx = 1e15 ; sum1 = sum2 = 0
for i in range(n): sum1 += arr[0][i]
for i in range(n): sum1 -= arr[0][i] ; mx = min(mx,max(sum1,sum2)) ; sum2 += arr[1][i]
print(mx)
#include<bits/stdc++.h>
#define ld long double
#define ss second
#define ff first
#define int long long
#define ull unsigned long long
#define all(x) x.begin(), x.end()
#define ll long long
#define rall(x) x.rbegin(), x.rend()
#define sz(a) (int)a.size()
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define yes cout << "YES" << endl;
#define no cout << "NO" << endl;
#define sp(x) fixed << setprecision(x)
#define ms multiset
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y);
using namespace std;
const string YES = "YES";
const string NO = "NO";
const long long MOD = 1e9 + 7;
const int N = 1e5 + 5;
const long long inf = 9e18;
const int M = 3e3 + 5;
const double EPS = 1e-6;
const ll neg = -1;
const string imp = "impossible";
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll B = uniform_int_distribution<ll>(0, M - 1)(rng);
void setIO(string name = "") {
if (sz(name)) {
freopen((name + ".in").c_str(), "r", stdin);
freopen((name + ".out").c_str(), "w", stdout);
}
}
void boost(){
ios_base::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
}
void solve(){
ll m; cin >> m;
ll a[2][m];
for(ll i = 0;i<2;i++){
for(ll j = 0;j<m;j++){
cin >> a[i][j];
}
}
ll pref1 = 0;
ll pref2 = 0;
for(ll i = 0;i<m;i++){
pref1+=a[0][i];
//pref2[]
}
ll res = inf;
for(ll i = 0;i<m;i++){
pref1-=a[0][i];
res =min(res,max(pref1,pref2));
pref2+=a[1][i];
}
cout << res << endl;
}
signed main(){
boost();
ll q = 1; cin >> q;
while(q--) {
solve();
}
return 0;
}
822A - I'm bored with life | 9A - Die Roll |
1430B - Barrels | 279B - Books |
1374B - Multiply by 2 divide by 6 | 1093B - Letters Rearranging |
1213C - Book Reading | 1468C - Berpizza |
1546B - AquaMoon and Stolen String | 1353C - Board Moves |
902A - Visiting a Friend | 299B - Ksusha the Squirrel |
1647D - Madoka and the Best School in Russia | 1208A - XORinacci |
1539B - Love Song | 22B - Bargaining Table |
1490B - Balanced Remainders | 264A - Escape from Stones |
1506A - Strange Table | 456A - Laptops |
855B - Marvolo Gaunt's Ring | 1454A - Special Permutation |
1359A - Berland Poker | 459A - Pashmak and Garden |
1327B - Princesses and Princes | 1450F - The Struggling Contestant |
1399B - Gifts Fixing | 1138A - Sushi for Two |
982C - Cut 'em all | 931A - Friends Meeting |