#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define all(a) (a).begin(), (a).end()
#define sz(a) (int) a.size()
#define pb push_back
#define ff first
#define sc second
#define pii pair<int, int>
#define f(i, l, r) for (int i = (l); i < (r); i++)
#define double ld
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n; cin >> n;
vector<int> a(n + 1), b(n);
for (int i = 0; i < n + 1; i++) cin >> a[i];
for (int i = 0; i < n; i++) cin >> b[i];
sort(all(a));
sort(all(b));
vector<int> pref(n+1,0), suff(n+1,0);
for (int i = 1; i <= n; i++) {
pref[i] = max(pref[i - 1], a[i - 1] - b[i - 1]);
suff[i] = max(suff[i - 1], a[n + 1 - i] - b[n - i]);
}
for (int i = 0; i <= n; i++) {
cout << max(pref[i], suff[n - i]) << ' ';
}
cout<<'\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
- |