제출 #460631

#제출 시각아이디문제언어결과실행 시간메모리
460631BarayGrowing Vegetables is Fun 4 (JOI21_ho_t1)C++17
컴파일 에러
0 ms0 KiB
#include <iostream> #include <vector> #include <set> #include <queue> #include <stack> #include <algorithm> using namespace std; int n, maxx = -1, maxpos, ans = INT_MAX; int main() { cin >> n; vector<int> arr(n), pre(n), suf(n); for (int i = 0; i < n; i++) { cin >> arr[i]; } for (int i = 1; i < n; i++) { pre[i] = pre[i - 1] + max(0, arr[i - 1] + 1 - arr[i]); } for (int i = n - 2; i >= 0; i--) { suf[i] = suf[i + 1] + max(0, arr[i + 1] + 1 - arr[i]); } for (int i = 0; i < n - 1; i++) { ans = min(ans, max(suf[i], pre[i + 1])); } cout << ans; }

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

Main.cpp:10:33: error: 'INT_MAX' was not declared in this scope
   10 | int n, maxx = -1, maxpos, ans = INT_MAX;
      |                                 ^~~~~~~
Main.cpp:7:1: note: 'INT_MAX' is defined in header '<climits>'; did you forget to '#include <climits>'?
    6 | #include <algorithm>
  +++ |+#include <climits>
    7 |