# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1133545 | nuutsnoynton | Just Long Neckties (JOI20_ho_t1) | C++20 | 133 ms | 11744 KiB |
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll n, m, r, x, y, i,p, j,cnt1,cnt, t,s, mx, mn, k;
cin >> n;
pair < ll, ll > P[n + 2];
for (i = 1; i <= n + 1; i ++) {
cin >> P[i].first;
P[i].second = i;
}
ll b[n + 2];
for (i = 1; i <= n; i++) {
cin >> b[i];
}
sort(b + 1, b + n + 1);
sort(P + 1, P + n + 2);
ll aragsh[n + 2], uragsh[n +2];
aragsh[n + 1] = uragsh[0] = 0;
for (i = n; i >= 1; i --) {
aragsh[i] = max(aragsh[i + 1], max(0ll, P[i + 1].first - b[i]));
}
for (i = 1; i <= n; i ++) {
uragsh[i] = max(uragsh[i - 1], max(0ll, P[i].first - b[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... |