GCDCNT - Editorial

In worst case there are a total of 2*50000 nos (including updates) that will be needing 10^5 * 2^6 * log2(50000) = 99901699 nodes that is well within the Memory Limit.

We have solved the problem in O( 2^6 * Q * log2(N) ) time and O( 9*10^7 ) memory

@nilmadhab1 what is square free divisor?

how to find F(x,L,R) in O(logN) time by querying over ordered set corresponding to x ? If I am using ordered_map , I can get iterator corresponding to L and R in O(logN) . But getting their difference will take linear time .

nice approach sir :slight_smile: +1

I am still a student. Anyway, thanks @sumitjha4321

And thanks @teruel98 for pointing out the error.