Submission #1023688

# Submission time Handle Problem Language Result Execution time Memory
1023688 2024-07-15T04:47:16 Z vjudge1 Just Long Neckties (JOI20_ho_t1) C++17
Compilation error
0 ms 0 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(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;
}

Compilation message

ho_t1.cpp: In function 'int main()':
ho_t1.cpp:16:32: error: 'LLONG_MAX' was not declared in this scope
   16 |     vector<long long> C(N + 1, LLONG_MAX);
      |                                ^~~~~~~~~
ho_t1.cpp:4:1: note: 'LLONG_MAX' is defined in header '<climits>'; did you forget to '#include <climits>'?
    3 | #include <algorithm>
  +++ |+#include <climits>
    4 | using namespace std;