Submission #1023701

# Submission time Handle Problem Language Result Execution time Memory
1023701 2024-07-15T05:01:01 Z vjudge1 Just Long Neckties (JOI20_ho_t1) C++17
0 / 100
1 ms 344 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits> 
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(B.begin(), B.end());
    vector<long long> C(N + 1, LLONG_MAX);
    for (int k = 0; k <= N; ++k) {
        long long Ak = A[k];
        auto it = lower_bound(B.begin(), B.end(), Ak);
        if (it != B.end()) {
            C[k] = min(C[k], max(0LL, *it - Ak));
        }
        if (it != B.begin()) {
            --it;
            C[k] = min(C[k], max(0LL, Ak - *it));
        }
    }
    for (int k = 0; k <= N; ++k) {
        cout << C[k] << " ";
    }
    cout << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -