Getting in TLE in NUMFACT

Can somebody please help and tell me why am I getting TLE?I think my solution is very much optimized.
My code-http://www.codechef.com/viewsolution/4317477

There is no need to multiply all the numbers, you can factorize them separately, then also the result will be the same. This multiplication generates a very large number and is causing TLE.


In this question you are supposed to calculate the frequency of all the prime factors, then add one to these frequency and after this just multiply these values.

Here’s the link to the editorial: http://discuss.codechef.com/questions/15943/numfact-editorial

Here’s my solution for the same in java: http://www.codechef.com/viewsolution/4318680

1 Like
//