Submission #1023650

# Submission time Handle Problem Language Result Execution time Memory
1023650 2024-07-15T04:12:32 Z vjudge1 Just Long Neckties (JOI20_ho_t1) C++17
0 / 100
0 ms 348 KB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    int N;
    cin >> N;
    vector<long long> A(N + 1), B(N);
    for (int i = 0; i <= N; ++i) {
        cin >> A[i];
    }
    for (int i = 0; i < N; ++i) {
        cin >> B[i];
    }
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    vector<long long> prefix_min_strangeness(N + 2, 0), suffix_min_strangeness(N + 2, 0);
    long long curr_min = 0;
    for (int i = 1; i <= N; ++i) {
        prefix_min_strangeness[i] = max(A[i] - B[0], curr_min);
        curr_min = min(curr_min, prefix_min_strangeness[i]);
    }
    curr_min = 0;
    for (int i = N; i >= 1; --i) {
        suffix_min_strangeness[i] = max(A[i] - B[N-1], curr_min);
        curr_min = min(curr_min, suffix_min_strangeness[i]);
    }
    for (int i = 1; i <= N + 1; ++i) {
        long long min_strangeness = min(prefix_min_strangeness[i-1], suffix_min_strangeness[i]);
        cout << min_strangeness << " ";
    }
    cout << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -