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;
using ll = long long;
using ull = unsigned long long;
using vi = std::vector<int>;
using pi = std::pair<int, int>;
#define REP(i,a,b) for(int i{ a }; i < b; ++i)
#define MP std::make_pair
#define PB push_back
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
void solve(int no) {
int n{};
cin >> n;
vi a(n + 1);
REP(i, 0, n + 1) cin >> a[i];
vi b(n);
REP(i, 0, n) cin >> b[i];
sort(ALL(a));
sort(ALL(b));
for(int i{ 0 }; i < n + 1; ++i) {
ll oddity{ 0 };
for(int j{ 0 }, k{ 0 }; k < n; ++j) {
if(i == j) continue;
oddity = max(oddity, ll(max(0, a[j] - b[k])));
++k;
}
cout << oddity << ' ';
}
cout << '\n';
}
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(0);
solve(0);
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... |