#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
#define F first
#define S second
#ifdef local
void setio(){freopen("/Users/iantsai/Library/Mobile Documents/com~apple~CloudDocs/cpp/Empty.md","r",stdin);}
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
void setio(){}
#define debug(x...)
#endif
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
setio();
int n;
cin>>n;
vector<int>a(n+1);
for(int i=0;i<=n;i++){
cin>>a[i];
}
vector<int>b(n);
for(int i=0;i<n;i++)cin>>b[i];
sort(all(a));
sort(all(b));
multiset<int>st;
for(int i=1;i<=n;i++){
st.insert(max(a[i]-b[i-1],0LL));
}
cout<<*st.rbegin()<<' ';
for(int i=1;i<=n;i++){
st.erase(st.find(max(a[i]-b[i-1],0LL)));
st.insert(max(a[i-1]-b[i-1],0LL));
cout<<*st.rbegin()<<' ';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |