Please help me remove TLE..I am a new user of CodeChef...PLz Help..(Java Program)

Hey guys!!
I am frustrated of getting TLE…Please help me out…I am new to codechef…
View my java program by clicking below or pasting the link below on your address bar:
[http://www.codechef.com/viewsolution/2503289
Please help…I have already tried of removing it many a times but everytime I am unsucessfull…
Regards,
Akash.
(4th Year Student)
(India).

This is a current contest problem, so we can not help you now. Better try to optimize your algo.

1 Like

For two reasons, we cannot help.

  1. This is a solution to a problem in an ongoing contest. Any problem-specific help is against the rules.
  2. Even if we try to help, the solutions are not public. Only you can view your submissions. (Please, do not copy and paste your code asking for help. That is against rules as well.)

What you can try?

  1. Try using faster algorithms (in terms of complexity)
  2. Try removing unwanted computations or anything of the sort
  3. Try optimizing portions of your code, which can take significant amount of time to run

I know, these are easier said, than done. But when done, you would also say, that was easily done :slight_smile:

A hint: Since the question you are trying to solve has a lot of accepted submissions, the problem might be easily solvable. If you are trying to complicate things, you might get a TLE. So, try thinking over the problem from start, once again. May be you will hit!!

And, Good Luck!

java codes are a bit heavy, which sometimes may cause TLE. Best solution is to avoid using java for such problems. Instead you can use languages like c/c++/python/scala/pascal etc. which are best to work with time limits.

alternatively you can also rethink your problem from beginning and may come-up with a better solution.
All the best…

//