Submission #655575

# Submission time Handle Problem Language Result Execution time Memory
655575 2022-11-04T18:34:54 Z happypotato Just Long Neckties (JOI20_ho_t1) C++17
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    int a[n + 2], b[n + 1];
    for (int i = 1; i <= n + 1; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) cin >> b[i];
    sort(a + 1, a + n + 2);
    sort(b + 1, b + n + 1);
    int ans[n + 2];
    for (int i = 1; i <= n + 1; i++) ans[i] = 0;
    int cur = 0;
    for (int i = 1; i <= n; i++) {
        cur = max(cur, abs(a[i] - b[i]));
        ans[i + 1] = max(ans[i + 1], cur);
    }
    cur = 0;
    for (int i = n + 1; i >= 2; i--) {
        cur = max(cur, abs(a[i] - b[i - 1]));
        ans[i - 1] = max(ans[i - 1], cur);
    }
    for (int i = 1; i <= n + 1; i++) cout << ans[i] << ' ';
    cout << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -