Submission details
Task:Dynamic Range Minimum Queries
Sender:aalto26dh_034
Submission time:2026-09-20 20:04:19 +0300
Language:C++ (C++20)
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:27:17: error: 'INT32_MAX' was not declared in this scope
   27 |       int res = INT32_MAX;
      |                 ^~~~~~~~~
input/code.cpp:5:1: note: 'INT32_MAX' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
    4 | #include <limits>
  +++ |+#include <cstdint>
    5 |

Code

#include <algorithm>
#include <iostream>
#include <vector>
#include <limits>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, q;
  if (!(cin >> n >> q)) return 0;

  vector<int> t(2 * n);
  for (int i = 0; i < n; i++) cin >> t[n + i];
  for (int i = n - 1; i > 0; i--) t[i] = min(t[2 * i], t[2 * i + 1]);

  for (int i = 0; i < q; i++) {
    int type, a, b;
    cin >> type >> a >> b;
    if (type == 1) {
      int p = n + a - 1;
      t[p] = b;
      for (p >>= 1; p > 0; p >>= 1) t[p] = min(t[2 * p], t[2 * p + 1]);
    } else {
      int res = INT32_MAX;
      for (int l = n + a - 1, r = n + b; l < r; l >>= 1, r >>= 1) {
        if (l & 1) res = min(res, t[l++]);
        if (r & 1) res = min(res, t[--r]);
      }
      cout << res << '\n';
    }
  }
  return 0;
}