#include <bits/stdc++.h>
using namespace std;
int a[200001],b[200001];
int s[200001];
int main()
{
int n;
cin>>n;
for(int i=0;i<n+1;i++)cin>>a[i];
for(int i=0;i<n;i++)cin>>b[i];
sort(b,b+n);
sort(a,a+n+1);
for(int i=n;i>0;i--){
s[i] = max(0,a[i] - b[i-1]);
if(i!=n)s[i] = max(s[i],s[i+1]);
}
int cur = 0;
for(int i=0;i<=n;i++){
int ans = cur;
if(i!=n){
ans = max(ans,s[i+1]);
cur=max(cur,a[i]-b[i]);
}
cout<<ans<<" ";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |