#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n; cin>>n;
vector<ll> a(n+1), b(n);
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.rbegin(), b.rend());
for (int i=0; i<=n; i++) {
int aind=0;
ll ans=0;
for (int j=n-1; j>=0; j--) {
if (aind==i) aind++;
ans=max(ans,max(a[aind]-b[j],0ll));
aind++;
}
cout<<ans<<" ";
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |