#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++) #define ALL(x) (x).begin(),(x).end() #define CASET2 int ___T, case_n = 1; scanf("%d ", &___T); while ((___T > 0 ? printf("Case #%d:\n", case_n++) : 0), ___T-- > 0) #define CASET1 int ___T, case_n = 1; scanf("%d ", &___T); while ((___T > 0 ? printf("Case #%d: ", case_n++) : 0), ___T-- > 0) #define CASET int ___T; scanf("%d ", &___T); while (___T-- > 0) #define SZ(X) ((int)(X).size()) #define LEN(X) strlen(X) #define REP(i,n) for(int i=0;i=(b);i--) #define REPL(i,x) for(int i=0;x[i];i++) #define PER(i,n) for(int i=(n)-1;i>=0;i--) #define RI1(x) scanf("%d",&x) #define RI2(x,y) RI1(x), RI1(y) #define RI3(x,y...) RI1(x), RI2(y) #define RI4(x,y...) RI1(x), RI3(y) #define RI5(x,y...) RI1(x), RI4(y) #define RI6(x,y...) RI1(x), RI5(y) #define GET_MACRO(_1, _2, _3, _4, _5, _6, NAME, ...) NAME #define RI(argv...) GET_MACRO(argv, RI6, RI5, RI4, RI3, RI2, RI1)(argv) #define DRI(argv...) int argv;RI(argv) #define WRI(argv...) while (RI(argv) != EOF) #define DWRI(x...) int x; WRI(x) #define RS(x) scanf("%s",x) #define MP make_pair #define PB push_back #define MS0(x) memset(x,0,sizeof(x)) #define MS1(x) memset(x,-1,sizeof(x)) #define X first #define Y second #define V(x) vector typedef long double LD; typedef pair PII; typedef vector VI; typedef long long LL; const int INF = 1000000000; void print(int i) { printf("%d", i); } void print(LL i); template void PI(T i) { print(i); puts(""); } template void PIS(T i) { print(i); printf(" "); } template void PV(T const &v, int N) { REP(i, N) { print(v[i]); printf("%c", i == N-1 ? '\n' : ' '); } } template void PV(T const &v) { PV(v, SZ(v)); } template bool has_bit(T mask, S i) { return (mask >> i) & 1; } long long shift(int i) { return 1ll << i; } template void mini(C&a4, C b4){a4=min(a4, b4); } template void maxi(C&a4, C b4){a4=max(a4, b4); } int popcount(int x) { return __builtin_popcount(x); } int popcount(long long x) { return __builtin_popcountll(x); } #define PZ(x) PI((x).i); template struct ZZ { static Short MOD; Short i; ZZ():i(0) {} ZZ(Short _i): i(_i >= 0 ? _i : _i + MOD) {} ZZ(Long _i): i(_i % MOD) {} void operator +=(const ZZ& z) { i += z.i; if(i >= MOD) i -= MOD; } void operator -=(const ZZ& z) { i -= z.i; if(i < 0) i += MOD; } void operator *=(const ZZ& z) { i = (Long) i * z.i % MOD; } void operator /=(const ZZ& z) { (*this) *= z.inverse(); } ZZ operator +(const ZZ& z) const { ZZ ret(i); ret += z; return ret; } ZZ operator -(const ZZ& z) const { ZZ ret(i); ret -= z; return ret; } ZZ operator *(const ZZ& z) const { ZZ ret(i); ret *= z; return ret; } ZZ operator /(const ZZ& z) const { return (*this) * z.inverse(); } // ZZ operator -() const { return ZZ(-i); } ZZ inverse() const { return pow(MOD - 2); } ZZ pow(long long b) const { ZZ x=Short(1),y=*this; while(b > 0){ if(b%2 == 1) x *= y; y *= y; // squaring the base b /= 2; } return x; } static vector factorial, inv_factorial; static ZZ fact(int n) { while(factorial.size() <= n) factorial.push_back(factorial.back() * SZ(factorial)); return factorial.at(n); } static ZZ inv_fact(int n) { if (n < inv_factorial.size()) return inv_factorial.at(n); int old_size = inv_factorial.size(); inv_factorial.resize(n+1); inv_factorial.at(n) = fact(n).inverse(); for (int i = n-1; i >= old_size; i--) { inv_factorial[i] = inv_factorial.at(i+1) * (i+1); } return inv_factorial.at(n); } static ZZ choose0(int n, int k) { assert(n < 1e7); if(n < k) return 0; return fact(n) * (inv_fact(k) * inv_fact(n-k)); } static ZZ choose1(int n, int k) { assert(k < 1e7); if (n < k) return 0; if (k == 0) return 1; return choose1(n-1, k-1) * n / k; } static pair factModExp(int n) { if (n == 0) return MP(1, 0); int e = n / MOD; pair pr = factModExp(e); if (e % 2) { return MP(ZZ(0) - pr.first * fact(n % MOD), pr.second + e); } else { return MP(pr.first * fact(n % MOD), pr.second + e); } } static ZZ choose2(int n, int k) { assert(MOD < 1e7); pair p1 = factModExp(n), p2 = factModExp(k), p3 = factModExp(n-k); if (p1.second > p2.second + p3.second) return 0; assert(p1.second == p2.second + p3.second); return p1.first / (p2.first * p3.first); } }; typedef ZZ Z; template<> int Z::MOD = 1000000007; template<> vector Z::factorial(1, 1); template<> vector Z::inv_factorial(1, 1); long long mul(long long a,long long b,long long mod=Z::MOD){ long long x = 0,y=a%mod; while(b > 0){ if(b%2 == 1){ x = x+y; if(x >= mod) x -= mod; } y = y*2; if(y >= mod) y -= mod; b /= 2; } return x%mod; } long long pow(long long a, long long b, long long c=Z::MOD){ long long x=1,y=a; // ll is taken to avoid overflow of intermediate results while(b > 0){ if(b%2 == 1){ x=mul(x, y, c); } y = mul(y, y, c); // squaring the base b /= 2; } return x%c; } int A[100005]; Z x; template struct SegmentTree { int n; vector dat; void update(int k, T const& a) { // starting from leaf node k += n - 1; dat[k] = a; while(k > 0) { k = (k - 1) / 2; dat[k] = dat[k * 2 + 1] + dat[k * 2 + 2]; } } T query(int a, int b) { if (a > b) return 0; return query(a, b+1, 0, 0, n); } T query(int a, int b, int k, int l, int r) { if(r <= a || b <= l) { // if [a, b) and [l, r) are disjoint return 0; } else if(a <= l && r <= b) { // if [l, r) contains [a, b) return dat[k]; } else { T vl = query(a, b, k * 2 + 1, l, (l + r) / 2); T vr = query(a, b, k * 2 + 2, (l + r) / 2, r); return vl + vr;; } } int real_size; SegmentTree(int n_) { real_size = n_; n = 1; while(n < n_) n *= 2; dat.resize(2*n-1); init(0, 0, n); } void init(int k, int l, int r) { if(r - l == 1) { // leaf if (l >= real_size) return; dat[k] = Z(x).pow(l) * A[l]; } else { // non-leaf init(k*2+1, l, (l + r) / 2); init(k*2+2, (l + r) / 2, r); dat[k] = dat[k*2+1] + dat[k*2+2]; } } }; #include #include #define EB emplace_back #define PL(x) printf("%lld\n", x) #define RL(x) scanf("%lld", &x) #define DRL(x) LL x; RL(x); int main() { DRI(N, a, b, Q); x = Z(-b) / a; REP(i, N) { RI(A[i]); } SegmentTree t(N+1); while (Q--) { DRI(type); if (type == 1) { DRI(i, c); if (b == 0) { A[i] = c; } else { t.update(i, x.pow(i) * c); } } else { DRI(l, r); if (b == 0) { puts(A[l] ? "No" : "Yes"); } else if (t.query(l, r).i == 0) { puts("Yes"); } else { puts("No"); } } } return 0; }