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