this code of mine gives TLE, i made a lot of changes to avoid it but wasnt successful,
plz help,
problem link - http://www.codechef.com/problems/TLCS
my code - http://ideone.com/MijXTp
this code of mine gives TLE, i made a lot of changes to avoid it but wasnt successful,
plz help,
problem link - http://www.codechef.com/problems/TLCS
my code - http://ideone.com/MijXTp
Can you please post the question link here?
Your solution gives TLE because you are performing about 10^9 operations in the worst case and that would take more than 5 seconds, which is the time limit for this problem.
Note that this a Challenge Problem, so you can optimize your solution to get a better relative score as compared to others for the given time limit.
For example, refer this solution which got 1.000 points or this solution which got 0.916 points.
yes, ur answer makes sense,
but for all cases requiring greater than 6*10^5 operations we dont calculate the LCS.i cant convince my self why it should not give WA in those cases,…
thanks for reply
Well, honestly, I am confused about that too. Don’t know why this is a Challenge problem. The ones who got 1.000 points just printed ‘N’ when time exceeded 4.9 seconds or similar. So, I hope someone else can give a better answer to our doubts.