답안 #1023664

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1023664 2024-07-15T04:31:23 Z vjudge1 Just Long Neckties (JOI20_ho_t1) C++17
컴파일 오류
0 ms 0 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
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> min_strangeness(N + 1, LLONG_MAX);
    for (int i = 0; i <= N; ++i) {
        auto it = lower_bound(B.begin(), B.end(), A[i]) - B.begin();
        if (it < N) {
            min_strangeness[i] = abs(A[i] - B[it]);
        }
        if (it > 0) {
            min_strangeness[i] = min(min_strangeness[i], abs(A[i] - B[it - 1]));
        }
    }
    for (int i = 0; i <= N; ++i) {
        cout << min_strangeness[i] << " ";
    }
    cout << endl;
    return 0;
}

Compilation message

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