#include <bits/stdc++.h>
using namespace std;
const int nx=2e5+5;
int n, a[nx], b[nx], l[nx], r[nx], mx;
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n;
for (int i=1; i<=n+1; i++) cin>>a[i];
for (int i=1; i<=n; i++) cin>>b[i];
b[n+1]=1e9;
sort(b+1, b+n+1);
sort(a+1, a+n+2);
for (int i=1; i<=n+1; i++) l[i]=max(l[i-1], a[i]-b[i]);
for (int i=n; i>=1; i--) r[i]=max(r[i+1], a[i+1]-b[i]);
for (int i=1; i<=n+1; i++) cout<<max(l[i], r[i])<<' ';
}
# |
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 |
- |