#include using namespace std; using ll = long long; /* link:https://yukicoder.me/problems/no/1234 长度为n的数目,q次操作,两种类型 1. a[l,r]的元素 +x 2. 求 a[l,r]区间最小值 */ template struct SqrtDecomposition{ using S = long long; // 待分块数据类型 using T = long long; // 答案数据类型 vector A; vector lazy, mns; int B; // 分块大小 int n; // 数组长度 SqrtDecomposition(const int _n) : n(_n) { A.resize(_n); B = B_size == -1 ? sqrt(n) : B_size; } SqrtDecomposition(const vector& v_) { A = v_; n = (int)(A.size()); B = B_size == -1 ? sqrt(n) : B_size; init(); } int get_start(int idx) const { return idx - idx % B; } int get_end(int bucket_start) const { return bucket_start + B < n ? bucket_start + B : n; } void set(int idx, S val){ assert(idx >=0 && idx < n); } void init(){ int m = (n + B - 1) / B; lazy.assign(m, 0); mns.resize(m); for (int i = 0, j = 0; i < n; i += B, j++) { mns[j] = *min_element(A.begin() + i, A.begin() + get_end(i)); } } T get_part(int l, int r) { T res = 1e18; int b = l / B; for(int i=l;i> n; SqrtDecomposition<3> s(n); for (auto &x : s.A){ cin >> x; } s.init(); cin >> q; for (int _i = 0; _i < q; ++_i) { int k, l, r, c; cin >> k >> l >> r >> c; l--; if (k == 1) { s.prod(l, r, c); } else { cout << s.get(l, r) << '\n'; } } return 0; }