#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
typedef long long ll;
const int NMAX = 2e5 + 5;
ll n, a[NMAX], b[NMAX];
multiset<ll> s;
int main(void){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n;
for(int i = 0; i <= n; i++) cin >> a[i];
for(int i = 0; i < n; i++) cin >> b[i];
sort(a, a + n + 1);
sort(b, b + n);
for(int i = 0; i < n; i++) s.emplace(a[i + 1] - b[i]);
cout << max(*s.rbegin(), 0LL) << ' ';
for(int i = 0; i < n; i++){
s.erase(s.find(a[i + 1] - b[i]));
s.emplace(a[i] - b[i]);
cout << max(*s.rbegin(), 0LL) << ' ';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |