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 1563. Bayan

WA 7 Hashing
Posted by Gio Pataraia [Tbilisi SU] 25 Apr 2011 02:15
i'm trying to solve this with hashing but i got wa on 7test..
i take max hash number 100000001..
is't possible that two different strings hash is equal?
Re: WA 7 Hashing
Posted by AterLux 25 Apr 2011 13:52
of course it possible that different data has equal hash.
for example, if you calculating hash by simple adding char codes, then strings "abc" and "cba" and "acb" etc. - will have equals hash.

But if you're lucky enough and chosen good hash formula, all tests can be passed, even though youre solution actually will be wrong and may give wrong answers on special (designed to your hash formula) tests.
Re: WA 7 Hashing
Posted by Gio Pataraia [Tbilisi SU] 27 Apr 2011 03:55
thanks, my formula was absolutly correct, there was some mistake in comparing to other hashes :)