#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
int a[n+2],b[n+1];
int pref[n+1],suf[n+2];
suf[n+1]=pref[0]=0;
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++)pref[i]=max(pref[i-1],a[i]-b[i]);
for(int i=n+1;i>1;i--)suf[i]=max(suf[i+1],a[i]-b[i-1]);
for(int i=1;i<=n+1;i++)cout<<max(pref[i-1],suf[i+1])<<" ";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |