Problem - https://www.codechef.com/problems/QNUMBER
My Solution (TLE) - https://www.codechef.com/viewsolution/47927664
Accepted Solution - https://www.codechef.com/viewsolution/34623272
Problem - https://www.codechef.com/problems/QNUMBER
My Solution (TLE) - https://www.codechef.com/viewsolution/47927664
Accepted Solution - https://www.codechef.com/viewsolution/34623272
Consider the test input:
9999999969 1
1 1
Thanks a lot dude!! Got accepted
Just a little more clarification needed.
Was the main problem with integer overflow? or with orig[i] getting updated unnecessarily?
Integer overflow - it prevented the for
loop in factorize
from ever terminating
Edit:
Remember that you can usually detect overflows by turning them into Runtime Errors.
Whoa that article is really really helpful. Big thanks brother