I have tried solving this http://www.codechef.com/problems/CHEFD/ problem using sqrt decomposition technique,but im getting AC for some cases and wrong answer for some cases......Can anyone discuss your idea using sqrt decomposition method for this problem,thanks......
Auto comment: topic has been updated by rahulnagurtha (previous revision, new revision, compare).
Do you already read the editorial?
Link: http://discuss.codechef.com/questions/51848/chefd-editorial
Hey ! I solved it :)
There is actually a cute way to solve the problem by processing the queries in reverse order and using segment trees/bit to keep how many times a value has been divided with on a certain position.
Auto comment: topic has been updated by rahulnagurtha (previous revision, new revision, compare).