#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
vector<int> a(n + 2);
vector<int> b(n + 1);
for(int i = 1; i <= n + 1; i++) {
cin >> a[i];
}
for(int i = 1; i <= n; i++) {
cin >> b[i];
}
sort(b.begin() + 1, b.end());
for(int i = 1; i <= n + 1; i++) {
set<int> s;
for(int j = 1; j <= n + 1; j++) {
if(j ^ i) {
s.insert(a[j]);
}
}
int ans = 0;
for(int j = 1; j <= n; j++) {
auto it = s.lower_bound(b[j]);
ans = max(ans, *it - b[j]);
s.erase(it);
}
cout << ans << " ";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |