DIVQUERY - editorial

thanks a lot
finally i got the concept.

u first created a list which is an array of vectors corresponding to each element from 2 to a_max of the given array and store all the indexes of elements which are divisible by k.

and then search(using binary search) how many elements are there between p1 and p2.

for eg for first query corresponding to k=2 there are two elements between 3 and 6.
corresponding to k=4 there is 1 element between 3 and 6
corresponding to k=3 there are 4 elements between 4 and 8
and so on…

exactly :wink:

can u please tell me the algorithm of above explanation.

In the tester’s solution, it is written:
“There is a known bound that integer N has at most O(n^(1/3))
divisors.”
Isn’t this bound wrong? When N = 83160, N has 128 divisors. But according to the bound by tester, N can have at most 43.6 divisors. Did I misunderstand the statement? What is the proof of the statement?

@betlista …This is a language specific problem…?? nobody submitted solution in c…?? is it not possible in c language ??

In Editorialist’s Solution, the last loop should run from “0 to Q - 1” instead of “0 to N - 1”

1 Like

urm…, yep, you are right. guess it didnt matter because N was always same as Q, but good point.