#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
int n;
cin>>n;
int a[n+2],b[n+1];
vector<int> p(n+2,0),s(n+2,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)
{
p[i] = abs(b[i]-a[i+1]);
s[i+1] = abs(b[i]-a[i]);
}
for (int i=n;i>0;--i)
p[i]=max(p[i],p[i+1]);
for (int i=2;i<=n+1;++i)
s[i]=max(s[i],s[i-1]);
for (int i=1;i<=n+1;++i)
cout<<max(p[i],s[i])<<" ";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |