This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define endl '\n'
#define int long long
#define mod 1000000007
#define boost ios_base::sync_with_stdio(false), cin.tie(NULL);
using namespace std;
int a[200001],b[200001],s[200001];
signed main(){
boost;
int n; cin >> n;
for(int i = 0; i < n + 1; i++) cin >> a[i];
for(int i = 0; i < n; i++) cin >> b[i];
sort(b,b+n);
for(int i = 0; i < n + 1; i++){
vector<int>x;
for(int j = 0; j < n + 1; j++){
if(i != j) x.push_back(a[j]);
}
sort(x.begin(), x.end());
int ans = 0;
for(int j = 0; j < n; j++){
ans = max(ans,x[j] - b[j]);
}
s[i] = ans;
}
for(int i = 0; i < n + 1; i++) cout << s[i] << ' ';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |