// Problem: E1. Game with Marbles (Easy Version) // Contest: Codeforces - Codeforces Round 916 (Div. 3) // URL: https://codeforces.com/contest/1914/problem/E1 // Memory Limit: 256 MB // Time Limit: 3500 ms // // Powered by CP Editor (https://cpeditor.org)
#include<bits/stdc++.h> usingnamespace std; typedeflonglong ll; typedefunsignedlonglong ull; #define int long long
constint N = 2e5 + 9; constint INF = 0x3f3f3f3f;
int a[N], b[N]; bitset<N> vis; structNode { int a, b, idx; booloperator < (const Node &u) const { return a + b > u.a + u.b; } } f[N];
voidsolve() { int n; cin >> n; for (int i = 1; i <= n; i ++) cin >> a[i]; for (int i = 1; i <= n; i ++) cin >> b[i]; for (int i = 1; i <= n; i ++) f[i] = {a[i], b[i], i}; sort(f + 1, f + 1 + n);
for (int i = 1; i <= n; i ++) { if (i & 1) a[f[i].idx] --, b[f[i].idx] = 0; else a[f[i].idx] = 0, b[f[i].idx] --; } int suma = 0, sumb = 0; for (int i = 1; i <= n; i ++) suma += a[i]; for (int i = 1; i <= n; i ++) sumb += b[i]; cout << suma - sumb << '\n'; }
signedmain() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); int T; cin >> T; while (T --) solve(); return0; }