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 1590. Bacon’s Cipher

Can we use hashes?
Posted by Khamitbekov Madi 6 Apr 2011 22:59
Can we solve this problems with hashes?
It takes TLE #3 with hash table...
Who solved with hashes, comment please =)
Re: Can we use hashes?
Posted by George_Aloyan[PTSObninsk] 21 Oct 2011 15:21
I tried, but i didn't use tables. Just calculated the number of different hashes. But I have WA3. And it seems quite interesting to me.
Re: Can we use hashes?
Posted by vlyubin 9 Feb 2012 07:10
George_Aloyan[PTSObninsk] wrote 21 October 2011 15:21
I tried, but i didn't use tables. Just calculated the number of different hashes. But I have WA3. And it seems quite interesting to me.

Why do you think that you could avoid hash collisions?
There could be 5000*5000/2 different substrings and if your hash size (modulo you are using) is less than that, some two will DEFINITELY be in the same section and they could be unequal. Even if your number is greater, you still can get WA because of a collision ...