Plz..Plz...Plz...help me get rid of TLE...I am a new programmer(JAVA)..

Question Link :: http://www.codechef.com/problems/DIVISORS

My Solution Link :: http://www.codechef.com/viewsolution/2571296

Regards,

Akash
(INDIA)

Hey @akash1357, I really recommend you to start with the EASY problems, when a problem is classified HARD in codechef it’s because IT IS HARD… You should start with the EASY ones so you can get used to programming in general because I think you don’t even understand why the problem you’re trying to solve is classified as HARD… Trust me, go for the “EASY” section, you’ll be surprised by what you can learn there…

2 Likes

@junior94, thanks for your answer…but still I insist on getting an answer to this question so that I can understand where I should improve so as not to get a TLE again.

Regards.

@akash1357 it is easy to get answer to a question using a brute force algorithm for small cases but this wont work on very large cases. in this question, the worst case calculations in your algorithm are 10^12 while accepted solutions have need to work in 10^8 per sec. so you need to make your code 10000 times faster.it requires advanced data structures and efficient algorithms which you might not know in your first few months but will learn gradually over time.if you insist then read this editorial.Please do not worry if you dont understand as it is tough. even i haven’t got the whole thing. As @junior94 said start from easy and proceed one step at a time.you will get to this question one day.

1 Like

P.S. don’t mean to rude but please dont ask for clarifications on the editorial as you will be wasting both yours and others time as well. It is a HARD problem after all.

1 Like

I didn’t solve this question yet @akash1357 so I can’t help you coming up with an algorithm to solve it but refer to @kcahdog answer. It’ll be hard to find someone who has solved that problem and is willing to explain it to a beginner in programming. I seriously recommend you to save the problem for later, it might sound harsh but you are underestimating the nature of problems here in codechef, you need to be both experienced in programming and algorithms to go for the medium and hard section…