Source Code
#include <bits/stdc++.h>

using namespace std;

#define all(v) (v.begin()), (v.end())
#define sor(x) sort(all(x))
#define pb(x) push_back(x)
#define fl(v, d) (memset(v, d, sizeof(v)))
#define len(s) ((int)s.size())
typedef long long ll;
typedef vector<int> vii;

#define MOD ll(1e9 + 7)
#define N (const ll)1e5 + 1

inline void solve()
{ 
    int n; 
    cin >> n;
    vii v(n), vv(n); 
    for (int i = 0; i < n; i++) {
        cin >> v[i]; 
    }
    int ans = 0; 
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        ans = max(ans, x - v[i]); 
    }
    cout << ans << "\n"; 
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }
}
Copy
Garden Walls Yazn_yousef
GNU G++17
45 ms
1.9 MB
Accepted