#include #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") using namespace std; vector m = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43}; const int sz = m.size(); int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(false); int N, Q; long long K; cin >> N >> Q >> K; vector A(N); for(int i = 0; i < N; i++) { cin >> A[i]; } vector> C(sz, vector(N + 1)); vector p(sz, 1); vector k(sz); for(int i = 0; i < sz; i++) { k[i] = K % m[i]; } for(int i = 0; i < N; i++) { for(int j = 0; j < sz; j++) { C[j][i + 1] = (C[j][i] + A[i] % m[j] * p[j] % m[j] + m[j]) % m[j]; p[j] = p[j] * k[j] % m[j]; } } while(Q--) { int L, R; cin >> L >> R; --L; bool fn = false; for(int i = 0; i < sz; i++) { if(C[i][R] - C[i][L] != 0) { fn = true; } } cout << (fn ? "Yes\n" : "No\n"); } return 0; }