#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n; cin >> n;
vector<int> a(n + 1), b(n);
for(auto &x : a) cin >> x;
for(auto &x : b) cin >> x;
sort(b.begin(), b.end());
for(int i = 0; i < n + 1; i++) {
map<int, int> mp;
for(int j = 0; j < n + 1; j++) {
if(i == j) continue;
mp[a[j]]++;
}
int res = 0;
for(int j = 0; j < n; j++) {
auto it = mp.begin();
int v = it -> first;
res = max(res, max(0, v - b[j]));
if(--mp[v] == 0) mp.erase(v);
}
cout << res << ' ';
}
cout << nl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |