ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1684. Jack's Last Word

Kumaar Why not "abra bra cada" [3] // Problem 1684. Jack's Last Word 17 Mar 2012 13:03
Even this answer is ok right?
Ramil Re: Why not "abra bra cada" [2] // Problem 1684. Jack's Last Word 2 Aug 2012 16:19
because 'bra' isn't prefix
paarth Re: Why not "abra bra cada" // Problem 1684. Jack's Last Word 7 Oct 2012 19:37
WA #3  please suggest

I do not have to take 1st string's legth in consideration...  I am doing kmp failure function tabulation...  for suffix match of string b with prefixes of a and thus ...  only b's string length is taken care of ....  plz suggest some test case where I might be wrong..
what m doing is this
--------------------------
// n is the string length of b
 f.resize(n+2);

  f[0]=-1;
  int x;
  for(int i=1;i<=n;i++)
    {
      x=f[i-1];
      while(x>=0&&a[x+1]!=b[i-1])
        x=f[x];

      if(a[x+1]==b[i-1])
        f[i]=x+1;
      else
        f[i]=-1;
    }
--------------------------------------------
paarth No subject // Problem 1684. Jack's Last Word 7 Oct 2012 19:37


Edited by author 07.10.2012 20:52