#include #include #include #include #include using namespace std; typedef long long ll; const ll mod = 1000000007; ll powmod(ll a, ll e) { ll sum = 1; ll cur = a; while (e > 0) { if (e % 2) { sum = sum * cur % mod; } cur = cur * cur % mod; e /= 2; } return sum; } /** * Segment Tree. This data structure is useful for fast folding on intervals of an array * whose elements are elements of monoid M. Note that constructing this tree requires the identity * element of M and the operation of M. * Header requirement: vector, algorithm * Verified by AtCoder ABC017-D (http://abc017.contest.atcoder.jp/submissions/660402) */ template class SegTree { int n; std::vector dat; BiOp op; I e; public: SegTree(int n_, BiOp op, I e) : op(op), e(e) { n = 1; while (n < n_) { n *= 2; } // n is a power of 2 dat.resize(2 * n); for (int i = 0; i < 2 * n - 1; i++) { dat[i] = e; } } /* ary[k] <- v */ void update(int k, I v) { k += n - 1; dat[k] = v; while (k > 0) { k = (k - 1) / 2; dat[k] = op(dat[2 * k + 1], dat[2 * k + 2]); } } void update_array(int k, int len, const I *vals) { for (int i = 0; i < len; ++i) { update(k + i, vals[i]); } } /* Updates all elements. O(n) */ void update_all(const I *vals, int len) { for (int k = 0; k < std::min(n, len); ++k) { dat[k + n - 1] = vals[k]; } for (int k = std::min(n, len); k < n; ++k) { dat[k + n - 1] = e; } for (int b = n / 2; b >= 1; b /= 2) { for (int k = 0; k < b; ++k) { dat[k + b - 1] = op(dat[k * 2 + b * 2 - 1], dat[k * 2 + b * 2]); } } } /* l,r are for simplicity */ I querySub(int a, int b, int k, int l, int r) const { // [a,b) and [l,r) intersects? if (r <= a || b <= l) return e; if (a <= l && r <= b) return dat[k]; I vl = querySub(a, b, 2 * k + 1, l, (l + r) / 2); I vr = querySub(a, b, 2 * k + 2, (l + r) / 2, r); return op(vl, vr); } /* [a, b] (note: inclusive) */ I query(int a, int b) const { return querySub(a, b + 1, 0, 0, n); } }; struct mp { ll operator()(ll a, ll b) const { return (a + b) % mod; } }; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int n, q; ll a, b; cin >>n >> a >> b >> q; SegTree st(n, mp(), 0); vector ary(n); vector pw(n); ll ba = b * powmod(a , mod - 2) % mod; ba = (mod - ba) % mod; pw[0] = 1; for (int i = 1; i < n; ++i) { pw[i] = pw[i - 1] * ba % mod; } for (int i = 0; i < n; ++i) { cin >> ary[i]; st.update(i, ary[i] * pw[i] % mod); } while (q--) { int ty, l, r; cin >> ty >> l >> r; if (ty == 1) { st.update(l, r * pw[l] % mod); ary[l] = r; } else { if (ba == 0) { ll t = ary[l]; cout << (t == 0 ? "Yes" : "No") << endl; } else { cout << (st.query(l ,r) == 0 ? "Yes" : "No") << endl; } } } return 0; }