virtual100's blog

By virtual100, 4 years ago, In English

here is the problem link : Anti Hash (SPOJ)

problem is related to polynomial string hashing , you are given P and M and also a string (let's say A) ,find and print another string (say B) which is different than A but have same hash as A.

here is what I am able to think till now : I am treating them as polynomial.

hash(A) = Polynomial Pa hash(B) = Polynomial Pb

since there hash is same hence , (Pa — Pb) % M must be zero.

I am not able to think how to proceed further.

any hint would be helpful , there are no editorial available for this problem.

Thank you.

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

| Write comment?
»
4 years ago, # |
  Vote: I like it +1 Vote: I do not like it

Someone asked for the idea of the same problem as yours and someone answered. Maybe you can click here to get some information.