Help needed in LCM range query problem

array
lcm
queries

#1

Given an array A of N (N<=210^4) elements and Q(Q<=10^6) queries. Each array element A<=60.

In each query you are given a number K (K<=N). Compute LCM for all subarrays of size K and report the smallest value of LCM found.
Please suggest some approach for this problem.


#2

Please post the link of the question for which you ask for help. It makes for us easy to verify our approach, before answering the question.


#3

http://codeforces.com/problemset/gymProblem/100570/A


#4

I tried storing precomputed results for subarrays of size<=sqrt(N) and for subarrays with size>sqrt(N), I used the brute force way but got TLE.


#5

http://codeforces.com/blog/entry/15722

The tutorial for the problem. It is on right panel on codeforces under contest materials


#6

I am looking for some other approach possible to solve this problem