#include <bits/stdc++.h>
using namespace std;
int nbTypes;
int main () {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> nbTypes;
vector<int> a(nbTypes + 1);
for (int iT = 0; iT <= nbTypes; iT ++)
cin >> a[iT];
vector<int> b(nbTypes);
for (int jT = 0; jT < nbTypes; jT ++)
cin >> b[jT];
sort(a.begin(), a.end());
sort(b.begin(), b.end());
vector<int> c(nbTypes + 1);
for (int iT = 0; iT < nbTypes; iT ++)
c[iT + 1] = max(iT == 0 ? 0 : c[iT], a[iT] - b[iT]);
vector<int> d(nbTypes + 1);
for (int jT = nbTypes - 1; jT >= 0; jT --)
d[jT] = max(
d[jT + 1],
a[jT + 1] - b[jT]
);
for (int i = 0; i <= nbTypes; i ++)
cout << max(c[i], d[i]) << " ";
}
# |
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 |
- |