Source Code
#include <bits/stdc++.h>
using namespace std;

void Solve() {
    int n;
    cin >> n;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
    }
    int answer = 0;
    for (int i = 1; i <= n; ++i) {
        int b;
        cin >> b;
        answer = max(answer, b - a[i]);
    }
    cout << answer << "\n";
}

int main() {

    int t;
    cin >> t;
    while (t--) {
        Solve();
    }

    return 0;
}
Copy
Garden Walls Light
GNU G++17
169 ms
952 KB
Accepted