제출 #1023687

#제출 시각아이디문제언어결과실행 시간메모리
1023687vjudge1Just Long Neckties (JOI20_ho_t1)C++14
컴파일 에러
0 ms0 KiB
#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; }

컴파일 시 표준 에러 (stderr) 메시지

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;