Source Code
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;

void solve() {
    int n;
    cin >> n;
    vector<int> v(n), v2(n);
    for (auto &x : v) {
        cin >> x;
    }
    for (auto &x : v2) {
        cin >> x;
    }

    int mx = 0;
    for (int i = 0; i < n; i++) {
        mx = max(mx, v2[i] - v[i]);
    }

    cout << mx << '\n';
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    cin >> t;
    while (t--) {
        solve();
    }
}
Copy
Garden Walls OsamaX01
GNU G++17
51 ms
1.9 MB
Accepted