#include <bits/stdc++.h>
#define int long
#define endl '\n'
using namespace std;
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
vector<int> a(n+1),b(n);
vector<int> pref(n+1),suf(n+2);
suf[n+1]=pref[0]=0;
for(int i=0;i<=n;i++)cin>>a[i];
for(int i=0;i<n;i++)cin>>b[i];
sort(a.begin(),a.end());
sort(b.begin(),b.end());
for(int i=1;i<=n;i++)pref[i]=max(pref[i-1],a[i-1]-b[i-1]);
for(int i=n+1;i>1;i--)suf[i]=max(suf[i+1],a[i-1]-b[i-2]);
for(int i=1;i<=n+1;i++)cout<<max(pref[i-1],suf[i+1])<<" ";
cout<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |