The problem statement is simple.
You are given an array A of N integers. You have to answer Q queries of three types.
Let val=∏Ri=LAi = Product of the subarray [ AL , AL+1 , AL+2 , ..... AR ]
A subarray is special if K√val is a integer . In other words the Kth root of product of the subarray should be a integer.
First line contains three integers N K Q.
Next line contains N integers A1 , A2 , A3 , ..... AN .
Next Q lines contains one of the three types of queries.
For each query of type 1 , print Yes if the subarray is special else No
Array during first query : A = [ 2 2 2 2 2 2 2 2 2 2 3 ]
A[10] * A[11] = 6 which doesnot have a integer square root.
Array during second query : A = [ 2 2 2 2 2 2 2 2 2 2 3 ]
A[4] * A[5] * A[6] * A[7] = 16 which has a integer square root = 4
Array after third query : A = [ 2 2 2 2 3 3 2 2 2 2 3 ]
For 4th query :
A[4] * A[5] * A[6] * A[7] = 36 which has a integer square root = 6
Array after 5th query : A = [ 2 2 6 6 9 3 2 2 2 2 3 ]
For 6th query :
A[3] * A[4] * A[5] * A[6] = 972 which doesnot have a integer square root