#include <iostream>
#include <set>
#include <algorithm>
using namespace std;
int main()
{
int N;
cin >> N;
int A[N+1];
for(int i = 0; i < N+1; i++) cin >> A[i];
sort(A, A+N+1);
int B[N];
for(int i = 0; i < N; i++) cin >> B[i];
sort(B, B+N);
multiset<int> strange;
for(int i = 1; i < N+1; i++) strange.insert(max(A[i] - B[i-1], 0));
cout << *strange.rbegin() << ' ';
for(int i = 1; i < N+1; i++)
{
strange.erase(strange.find(max(A[i] - B[i-1], 0)));
strange.insert(max(A[i-1] - B[i-1], 0));
cout << *strange.rbegin() << ' ';
}
cout << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |