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>
using namespace std;
#define int long long
signed main() {
int n;
cin >> n;
vector<int> a(n + 1), b(n);
for (int i = 0; i < n + 1; i++) {
cin >> a[i];
}
for (int j = 0; j < n; j++) {
cin >> b[j];
}
sort(b.begin(), b.end());
vector<int> ans;
for (int i = 0; i < n + 1; i++) {
vector <int> v;
for(int j = 0 ; j < n + 1; j++){
if(i == j){
continue;
}
else{
v.push_back(a[j]);
}
}
sort(v.begin() , v.end());
int mn = 0;
for(int j = 0 ; j < n; j++){
mn = max(mn , v[j] - b[j]);
}
ans.push_back(mn);
}
for(auto x : ans){
cout << x << " ";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |