can we solve it by findind d lcm and den calulating total prime factors, which approach can solve it in better runtime. plz help
Yes i also tried the problem by finding the lcm of all the numbers and then calculated the no. of prime factors of the lcm of all the numbers… but it gives WA … how it is wrong can anybody explain…plz ??
yeah, I too think the approach is right. But why WA? Have you found any explanation
It seems ok when looked at first but have you checked when LCM = 1 (all are 1’s) the answer must be 0 (the corner cases).
Hi,
I have used the same approach as described in the solution, and getting correct answer for the first task. But I am getting incorrect answer for 2nd and 3rd tasks. Could someone take a look as to what would have went wrong in my approach? I have generated lot of random testcases for the 2nd task and compared solution in editorial to my solution and am getting the same answer for all the tests. I really request someone to please take a look and let me know.
http://www.codechef.com/viewsolution/4945527
Thanks
The following link is my code:
http://www.codechef.com/viewsolution/5480907
It’s resulting in a TLE for the last subtask. Could someone please suggest some ways to optimize this to get it accepted within the time limit? I have exactly followed the method described in the editorial, so it is my factorization technique (brute force sieve method as mentioned in editorial only ) which is far too long I guess.
Or is trial division redundant in this problem and I have to resort to Pollard Rho method?