#include <bits/stdc++.h>
#define int long long
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
signed main(){
ios_base::sync_with_stdio();
cin.tie(0);cout.tie(0);
int n;
cin>>n;
vector <int> a(n+1),b(n);
for(int i=0;i<=n;i++)cin>>a[i];
for(int i=0;i<n;i++)cin>>b[i];
sort(all(b));sort(all(a));
int mx=0;
for(int i=0;i<n;i++){
mx=max(mx,max(0ll,a[i]-b[i]));
}
vector <int> ans;
ans.pb(mx);
for(int i=n;i>=1;i--){
mx=max(mx,max(0ll,a[i]-b[i-1]));
ans.pb(mx);
}
reverse(all(ans));
for(auto x : ans)cout<<x<<" ";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |