이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int nbTypes;
int main () {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> nbTypes;
vector<int> a(nbTypes + 1);
for (int iT = 0; iT <= nbTypes; iT ++)
cin >> a[iT];
vector<int> b(nbTypes);
for (int jT = 0; jT < nbTypes; jT ++)
cin >> b[jT];
sort(a.begin(), a.end());
sort(b.begin(), b.end());
vector<int> c(nbTypes + 1);
for (int iT = 0; iT < nbTypes; iT ++)
c[iT + 1] = max(iT == 0 ? 0 : c[iT], a[iT] - b[iT]);
vector<int> d(nbTypes + 1);
for (int jT = nbTypes - 1; jT >= 0; jT --)
d[jT] = max(
d[jT + 1],
a[jT + 1] - b[jT]
);
for (int i = 0; i <= nbTypes; i ++)
cout << max(c[i], d[i]) << " ";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |