# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
958283 | aykhn | Just Long Neckties (JOI20_ho_t1) | C++17 | 102 ms | 15440 KiB |
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
#define inf 0x3F3F3F3F
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
int a[n + 2], b[n + 1], p[n + 2], s[n + 3], ans[n + 2];
for (int i = 1; i <= n + 1; i++) cin >> a[i];
for (int i = 1; i <= n; i++) cin >> b[i];
vector<int> o(n + 2, 0);
iota(o.begin() + 1, o.end(), 1);
sort(o.begin() + 1, o.end(), [&](const int &x, const int &y)
{
return a[x] < a[y];
});
sort(a + 1, a + n + 2);
sort(b + 1, b + n + 1);
p[0] = -inf;
s[n + 2] = -inf;
for (int i = 1; i <= n; i++) p[i] = max(p[i - 1], a[i] - b[i]);
for (int i = n + 1; i > 1; i--) s[i] = max(s[i + 1], a[i] - b[i - 1]);
for (int i = 1; i <= n + 1; 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... |