/** * @author SCaffrey (srius.caffrey@gmail.com) * @date 2016-02-06 19:29:18 * @copyright MIT */ #include // NOLINT #include // NOLINT #include // NOLINT #include // NOLINT #define x1 x11 #define y1 y11 #define f(x, y, z) for (int x = (y), __ = (z); x < __; ++x) #define g(x, y, z) for (int x = (y), __ = (z); x <= __; ++x) #define fd(x, y, z) for (int x = (y), __ = (z); x > __; --x) #define gd(x, y, z) for (int x = (y), __ = (z); x >= __; --x) #ifdef WIN32 #define LLD "%I64d" #define LLU "%I64u" #else #define LLD "%lld" #define LLU "%llu" #endif typedef long long LL;// NOLINT typedef long double real; const double INF = 1e100; const int oo = ~0u >> 2; const double pi = acos(-1.0); const double EPS = 1e-8; const int MAXN = 100033; int T; int n; int a[MAXN]; int dp[MAXN]; void solve() { scanf("%d", &n); g(i, 1, n) scanf("%d", a + i); std::sort(a + 1, a + n + 1); g(i, 1, n) dp[i] = std::max(dp[i - 1], a[i] - dp[i - 1]); printf("%d\n", dp[n]); } int main() { #ifdef LOCAL freopen("a.in", "r", stdin); freopen("a.out", "w", stdout); #endif scanf("%d", &T); while (T--) { solve(); } #ifdef LOCAL fclose(stdin); fclose(stdout); #endif return 0; }