이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |