lone_rider's blog

By lone_rider, 9 years ago, In English

Need some help in this problem. I'm doing this problem using Tries + DFS + DP. My dp[i] basically stores number of different phrases from ith index to n-1th index. So the final result would be stored in dp[0]. My approach seems to be correct i guess but still i'm getting wrong answer. Here is the link to the problem -> http://www.spoj.com/problems/MORSE/ Here is the link to my code -> http://ideone.com/qmIMKm

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By lone_rider, 9 years ago, In English

I'm facing problem with this question. I'm getting TLE on test case 19th. I'm doing this question using Tries. Complexity of my code is O(3 * total length of input) which is no where close to getting TLE. Here is my code : http://ideone.com/uNbDf9. Please help

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it