题目描述
You are given an array ${A}$ of size $N$. You are asked to answer ${Q}$ queries.
Each query is of the form :
${ij x}$
You need to print Yes if ${x}$ divides the value returned from $find(i,j)$ function, otherwise print No.
find(int i,int j)
{
if(i>j) return 1;
ans = pow(A[i],find(i+1,j))
return ans
}
Input Format
First line of the input contains $N$. Next line contains $N$ space separated numbers. The line, thereafter, contains ${Q}$ , the number of queries to follow. Each of the next ${Q}$ lines contains three positive integer ${i}$, $j$ and ${x}$.
Output Format
For each query display Yes or No as explained above.
Constraints
$2\leq N\leq2\times10^5$
$2\leq Q\leq3\times10^5$
$1\leq i,j\leq N$
$i\leq j$
$1\leq x\leq10^{16}$
${{0}\leq$ value of array element $\leq10^{16}$
No 2 consecutive entries in the array will be zero.
Sample Input
4
2 3 4 5
2
1 2 4
1 3 7
Sample Output
Yes
No
输入格式
见题面
输出格式
见题面