#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)x.size())
#define sumof(x) accumulate(all(x), 0ll)
const int N=2e5+10;
int pre[N], suf[N], n, a[N], b[N];
void solve(int tc){
// cout << "Case #" << tc << ": ";
cin >> n;
for (int i=1; i<=n+1; ++i) cin >> a[i];
for (int i=1; i<=n; ++i) cin >> b[i];
sort(a+1, a+n+2);
sort(b+1, b+n+1);
for (int i=1; i<=n; ++i) pre[i]=max(pre[i-1], a[i]-b[i]);
for (int i=n; i>=1; --i) suf[i]=max(suf[i+1], a[i+1]-b[i]);
for (int i=1; i<=n+1; ++i) cout << max(pre[i-1], suf[i]) << " \n"[i==n+1];
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int ntests=1;
// cin >> ntests;
for (int i=1; i<=ntests; ++i) solve(i);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |