#include namespace { #pragma GCC diagnostic ignored "-Wunused-function" #include #pragma GCC diagnostic warning "-Wunused-function" using namespace std; using namespace atcoder; #define rep(i,n) for(int i = 0; i < (int)(n); i++) #define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--) #define all(x) begin(x), end(x) #define rall(x) rbegin(x), rend(x) template bool chmax(S& a, const S& b) { if (a < b) { a = b; return true; } else return false; } template bool chmin(S& a, const S& b) { if (b < a) { a = b; return true; } else return false; } using ll = long long; using P = pair; using VI = vector; using VVI = vector; using VL = vector; using VVL = vector; default_random_engine gen(chrono::system_clock::now().time_since_epoch().count()); template struct MultiMod { tuple...> val; MultiMod() = default; MultiMod(integral auto x) { (..., (get(val) = x)); } friend MultiMod operator+(const MultiMod& lhs, const MultiMod& rhs) { MultiMod res; res.val = tuple((get(lhs.val) + get(rhs.val))...); return res; } friend MultiMod operator-(const MultiMod& lhs, const MultiMod& rhs) { MultiMod res; res.val = tuple((get(lhs.val) - get(rhs.val))...); return res; } friend MultiMod operator*(const MultiMod& lhs, const MultiMod& rhs) { MultiMod res; res.val = tuple((get(lhs.val) * get(rhs.val))...); return res; } explicit operator bool() { return (... || get(val).val()); } static void mod_init() { (..., dynamic_modint::set_mod(uniform_int_distribution<>(1, 2000001000)(gen))); } }; } int main() { ios::sync_with_stdio(false); cin.tie(0); using S = MultiMod<0,1,2,3,4,5,6,7,8,9,10>; S::mod_init(); int n, q; ll k_ll; cin >> n >> q >> k_ll; S k(k_ll); VL a(n); rep(i, n) cin >> a[i]; vector s(n + 1); rrep(i, n) { s[i] = s[i+1] * k + a[i]; } vector pow_k(n + 1); pow_k[0] = 1; rep(i, n) pow_k[i+1] = pow_k[i] * k; rep(_, q) { int l, r; cin >> l >> r; l--; S v = s[l] - s[r] * pow_k[r - l]; cout << (v ? "Yes\n" : "No\n"); } }