TLE on Equivalent Strings

Revision en1, by hsr, 2015-07-22 20:54:07

I was solving http://codeforces.com/contest/560/problem/D

No matter how much I tried, I could not get pas testcase #91, it was always TLE for that one.

Then I tried switching the order in which the recursive function is called and then the programs passed within 31ms (program had 2s timelimit)

Here are the 2 solutions:

Accepted : http://codeforces.com/contest/560/submission/12186813

TLE : http://codeforces.com/contest/560/submission/12186933

Is there any reason why it failed or is it by pure co-incidence that the test cases broke my program.

Tags 560d, recursion

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English hsr 2015-07-22 20:54:07 756 Initial revision (published)